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. read cookie value which is set by website browsed in emulator browser

Hi,
In my app i want to use the cookie value which is set when user open
my website in android phone browser.
Is it possible to read value of cookie which is set by browser of my
android phone??

Thnx
--~--~---------~--~----~------------~-------~--~----~

2. problem occur while writing android.provider.Settings.Secu颅re.ENABLED_INPUT_METHODS

I have a problem while writing
android.provider.Settings.Secure.ENABLED_INPUT_METHODS in my
application. It will throw a security exception:
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):
java.lang.SecurityException: Cannot write secure settings table
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.os.Parcel.readException(Parcel.java:1234)
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.database.DatabaseUtils.readExceptionFromParcel
(DatabaseUtils.java:144)
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.database.DatabaseUtils.readExceptionFromParcel
(DatabaseUtils.java:110)
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.content.ContentProviderProxy.insert
(ContentProviderNative.java:
320)
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.content.ContentResolver.insert(ContentResolver.java:336)
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.provider.Settings$NameValueTable.putString(Settings.java:409)
03-17 17:43:15.717: ERROR/AndroidRuntime(6950):     at
android.provider.Settings$Secure.putString(Settings.java:1520)
--~--~---------~--~----~------------~-------~--~----~

3. Is it normal to play an audio during phone call?

4. How to display local file in WebView

5. Trying to understanding Gallery fling source code

6. no sound of my media player

7. "Failed to reopen debug port for Selected Client to: 8700" error