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. A basic map application

Hello,

I want make an app that opens a map (similarly to the Google Maps
app), centers on the current location of the user, fetches the
locations of ten nearby points-of-interest from my website, and then
renders them on the map as pins. When one of the pins is tapped, a
menu of actions pertaining to that point-of-interest should come up.

Can someone very kindly give me some pointers on how to accomplish
something along these lines? If anyone happens to know of any
tutorials that could be relevant, I'd be grateful for links too.
Thanks in advance.

Best regards,
Anders Feder
--~--~---------~--~----~------------~-------~--~----~

2. URGENT: install sqlite db on Android phone???

Folks, apologies ... I have a very urgent request. Tomorrow I want to
present an Android application on the phone (not on the emulator) to a
group of students. I have a Samsung Galaxy running on Android 1.5.

I got it all hooked up and I can see the device using "adb devices". I
can also see it in DDMS. So the connection is fine. I even can install
the application on the device - but I cannot run it.

The main problem seems to be that my application cannot access the
corresponding local SQLite database. Everything works perfectly on the
emulator. I figured out that I also cannot access the data/data folder
on the devices. It says "permission denied". Then I found out that I
have to "root" the device. But absolutely no clue how I can do that.
Also installing the apk through "adb install ...." did not work.

What can I do in order to get my SQLite db on the device? Do I have to
root it?

Again, as this is really urgent (until tonight Wed July 29th) please!

Regards Christian

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

3. Correct intent to launch gallery / video camera

4. rotate pointer on map

5. What is Mediaplayer.[..] onBufferingUpdate actually telling me?

6. Best way to format text on android surface?

7. What is Donut?