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. High memory usage reported in running services activity

I've seen that my background service is allocating 25Mbs according to
the Running Services android window. As it is a lot of memory that I
think I don't use I looked to ddms and also made a head dump of my
process and then the memory usage is only 2.9Mb

What's is the real memory usage? If it is the ddms one is there any
way to let running services give the correct usage? Because I'm afraid
that if some user look at the running services it will say that the
application is wasting a lot of memory.

-- 

2. How to stream video to android device over HTTP.

Hi,

I would like to stream video files to Android device, and intend to
integrate playback in my application.

I first tried to use flash video streaming, which works pretty nice on my
HTC Hero which integrated flash player, but now on Floyo ROM it does not
work any more. I guess HTC player is more complete than froyo 2.2 flash
support.

Then I tried to stream with VLC software using RTSP and it appears to work
only with WiFi. On 3G, I see on the streaming PC that the stream is sent,
but nothing is displayed on the Android device, whereas it works on WiFi.
I found this very interesting page from "VLC stream & convert" developper
which seems to show that this method is hazardous. Indeed the proposed test
does not work at all on my device/operator.
http://traveldevel.com/vlc-stream-convert/streaming-over-3g

Finally I am trying to stream over HTTP. I made it work (WiFi AND 3G) for
audio stream only, but when I try to stream audio+video, it does not work at
all (WiFi nor 3G). Of course I set the bitrate and screen size to low so it
is supposed to work at least in WiFi. I tried several combination
codec/muxer with no luck.

So anyone knows if it is ever possible to stream video over HTTP? if yes,
any idea which codec/muxer is supposed to work?

Or at least what is the most universal and/or recommanded way to stream
video to android device??

Thanks for any help,

-- 
Thierry.

-- 

3. Difference between "Cancel Entire Order" and Refunding in Google Checkout?

4. View.onAnimationEnd

5. Add Image in videoView

6. Carousel View Animation..?

7. VOLD is missing from product build