Disable Button after click

by pabbot » Sat, 12 Mar 2011 02:54:05 GMT


Sponsored Links
 Hi all,

In my application, when I click on a button that inserts a record on
the database and closes the Activity, sometimes it takes long to close
that Activity and some users are clicking on the Button twice. That
causes that the record is inserted twice in the database.

Is there any way of avoiding this behavior?

Thanks in advance!

-- 



Re: Disable Button after click

by Cliff Davies » Sat, 12 Mar 2011 02:58:53 GMT


 Set a boolean variable when the button has been pressed and check the
boolean is false in the on click listener so that you don't process it once
it's already been clicked





-- 


Sponsored Links


Re: Disable Button after click

by TreKing » Sat, 12 Mar 2011 03:03:36 GMT


 




Just disable the button when it's clicked, especially if you're closing the
Activity anyway.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Re: Disable Button after click

by Justin Anderson » Sat, 12 Mar 2011 03:07:01 GMT


 *> Is there any way of avoiding this behavior?*

Yes. Disable the button.
 http://developer.android.com/reference/android/widget/TextView.html #setEnabled%28boolean%29

Thanks,
Justin Anderson
MagouyaWare Developer
 http://sites.google.com/site/magouyaware 






-- 



Re: Disable Button after click

by Sourav Howlader » Sat, 12 Mar 2011 04:24:01 GMT


 As soon as the button is clicked, set  button.setEnable(false);
  This will disable the button and will avoid from double clicking it.




-- 



Other Threads

1. Best way to format text on android surface?

I want to have more control over the display of text on a surface than I know 
how to do.

I want to be able to zoom in and out, scroll vertically and horizontally, and 
use different size fonts.

Would I do this with RelativeLayout or is there a better way?

Is there an example code somewhere that shows how to do some or all of this?

I expect that the profusion of devices entering the market this fall will 
increase the need to adjust layouts to multiple screen sizes.  So I would like 
to avoid fixed placement to specific screen locations.

What I am seeking here is an idea how to approach this problem in Android.

Thanks.


--~--~---------~--~----~------------~-------~--~----~

2. What is Donut?

I've been having some twitter exchanges with JBQ and reading around the various 
articles and I think I understand what donut is so I'm throwing it out to the 
list so we can clear anything up.

There is not one Donut but two. (Mmmmm... Donuts)

One is the codename for the next release (i.e. donut release), One is the 
branch in the git repo (i.e. donut tree). The feature set and version number 
for the donut release has not been fixed. The features in the donut tree and 
candidates for the donut release but are not guaranteed to be part of the donut 
release.

As for a donut release version number, JBQ seems to think that "System V" is 
unlikely but anything is possible :).

So; If you're using one of the donut sdks from the open source build you are 
using the donut tree and so it has candidate features, you are not using the 
donut release (because the shape and sprinkles for donut release have not been 
finalise), so some features may not make the cut.

The other thing to remember is that OEMs and carriers get their hand in so even 
if a feature in donut tree does make it into donut release the OEM or carrier 
may remove it before consumers get a chance to take a bite.

Does anyone think this isn't right?

Al.

P.S. As I understand things Romains' comment about "donut is not 2.0" should be 
read as "At the point in time when the comment was made donut tree does not 
contain just contain features for a donut release, and 2.0 has not been decided 
upon as the version number for the donut release. In the future the donut 
release may be given the 2.0 version number, but that has not been decided upon 
so *at this point in time* donut is not 2.0".
-- 

* Written an Android App? - List it at http://andappstore.com/ *

======
Funky Android Limited is registered in England & Wales with the
company number 6741909. The registered head office is Kemp House,
152-160 City Road, London, EC1V 2NX, UK.

The views expressed in this email are those of the author and not
necessarily those of Funky Android Limited, it's associates, or it's
subsidiaries.



--~--~---------~--~----~------------~-------~--~----~

3. How Refresh Updated Contacts in list view using Base adapter

4. Dialer

5. link to an existing app in the market

6. why binder report transaction failed

7. Is there any APIs for retrieving the phone call infomation?