AlertDialog Timeout

by Shekhar » Fri, 23 Apr 2010 01:26:32 GMT


Sponsored Links
 Hi,

I have to create an alert dialog which will timeout after 3
seconds.How can I use timer for it? In AlertDialog class i am not
seeing any member function to set it.

Thanks,
Shekhar

--



AlertDialog Timeout

by krox » Fri, 23 Apr 2010 01:31:17 GMT


 Hi!

Maybe not the optimal solution (quite new to Android development) but
spawn a new thread when you show() the AlertDialog, let the Thread
sleep 3000 ms and then call myDialog.dismiss(). You might have to use
RunOnUIThread() as well since it is messing with the UI. Someone out
here might have a more elegant solution but this should
(probably ;-) ) work.

Cheers,
Erik



>


Sponsored Links


AlertDialog Timeout

by Liviu Ungureanu » Fri, 23 Apr 2010 01:35:43 GMT


 Hi!

 You have to create a thread which count until 3 and when counter is 3 you
have to call - via an handler -  yourDialogObject.cancel().

Hope this help.

--



AlertDialog Timeout

by faizan khan » Fri, 23 Apr 2010 03:22:31 GMT


 use java.util.timer to invoke timertask which will trigger
dialog.dismiss().do not forget to call dialog.dismiss from UI thread





> >



Other Threads

1. How can ImageView data refresh in thread ?

Thank you for your answer !

imgView.setBitmap(bm) is working very well without failure in thred routine
as you described

but I need refreshing of screen with new bitmap image data repeatedly.

In addition to your code, for the purpose of refreshing new image data, I
added infinite loop with while(isStop) operation.


public MyThread extends Thread {
 Handler handler;
 public MyThread() {
   super();
    handler = new Handler();
 }
 public void run() {
   ..
   ...
   handler.post(new Runnable() {
     public void run() {
       while(isStop){
            imgData = getImage();  // imgData receive jpeg image data
            bm = BitmapFactory.decodeByteArray(imgData,0,imgData.length); //
convert jpeg image into bitmap
            imgView.setBitmap(bm);
       }
     }
   });
   ...
 }
}

then this program works with no error.
While loop goes on...
I can have right image data, but display never refresh with new image data.
and program didn't response any kind of input such like a button.




2009/3/3 Streets Of Boston <flyingdutc...@gmail.com>




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

2. How to detect roaming event?

Hi developers,

Is it possible to detect a roaming event programmatically? I am able to use 
TelephonyManager.isNetworkRoaming()  to query roaming state. However, can I 
receive a notification exactly the moment the roaming state changes? 
I guess it should be possible because they display the R uicon in the status 
bar the moment when we enter roaming but what is the exact API and is it open?

Thank you
--~--~---------~--~----~------------~-------~--~----~

3. How to send Files Using Socket communication

4. How to add plugging of projects to project on eclipse

5. Libraries and Services Questions

6. HTML Parsing..?

7. Unbundle/copy raw resource binary file to sdcard (how to?)