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. Accessing character data (CDATA) of XML element

That error says that Android does not support a validating SAX parser
(does not validate documents with DTD).  So you have to  remove the
"spf.setValidating(true); " statement.

I went looking for the source for
javax.xml.parsers.SAXParserFactory.java but don't know where in
android.git to find the source for the java.* and javax.* packages -
anybody know where that is?

Also note android.util.Xml is useful for XML processing -

http://developer.android.com/intl/zh-CN/reference/android/util/Xml.html




-- 

2. Sir...Fw: Let's connect on LinkedIn

Seriously, it ain't polite spamming like this....


_____
have you googled anything today?

-----Original Message-----
From: Muhammad Rayhan <saviour...@gmail.com>
Date: Fri, 25 Dec 2009 22:06:57 
To: <wol...@gmail.com>
Subject: Let's connect on LinkedIn

LinkedIn
------------



   
I'd like to add you to my professional network on LinkedIn.

- Muhammad Rayhan

Confirm that you know Muhammad Rayhan
https://www.linkedin.com/e/isd/951290654/SnU_Dswt/

Every day, millions of professionals like Muhammad Rayhan use LinkedIn to 
connect with colleagues, find experts, and explore opportunities.



 
------
(c) 2009, LinkedIn Corporation


-- 
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

3. A question regarding AsyncTasks

4. Is there any way to let the app know whenever any media file is inserted into the sdcard?

5. Hey Guyz Chk this out

6. problem in AutoCompleteTextView

7. Halo Salam Kenal Semua