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. XML namespace?

Hi, is their an xml namespace or some sort of api that easily allows
me to construct my own xml schema?

I know i could use something like this to do it:

   xml += "<cardNumber>" + thisCard.CardNumber + "</cardNumber>";
            xml += "<expiryDate><date month='" +
thisCard.Expires.Month.ToString() + "' year='" +
thisCard.Expires.Year.ToString() + "' /></expiryDate>";


But is their an api where i can set the attributes something like
xml.AddNode() which is a .net

-- 

2. Breaking news

Rame di tv-metro
Susno ditangkap paksa di bandara pas mau ke Sing

^ Jus ^
~ envoyer utilisant blanc d'un google~
Super CDSI V4 
-- 
"Indonesian Android Community [id-android]" 

3. (ask) software camera paling bagus apa buat magic?

4. OOT: opensource for dummies

5. Context menu keycode

6. Is it possible to use MediaPlayer to play streaming audio?

7. Is it possible to use MediaPlayer to play streaming audio?