I have thought about this a bit further. You should be able to do this with some work.
If I am not mistaken what you are wanting to do is a special case of something like a "Progress Dialog" except it is custom and the user wants to dismiss it explicitly. Also you must not wait for the onPostExecute. My high level thougths are: 1. Create a dialog as you normally do in onCreateDialog() and return that dialog 2. Keep a pointer to the dialog so that you can alter the view in that dialog some manner 3. Kick off your asynctask 4. Update progress on your dialog with a visual cue 5. OnPostExecute enable a button on the dialog to do the desired action by the user I think this will work...(if it suits your intent) On Fri, May 6, 2011 at 5:14 PM, venkata raidu <venkata.ra...@gmail.com> wrote: > Thank you Satya. Using Activity would solve the problem. But, I > thought, by using a dialog, the user don't have to leave the current > screen and also, since the dialog is transparent, the user can see > the background always. By the way, I own your book. It is a very good > comprehensive book for Android. > > Venkata > > On May 6, 1:57 pm, Satya Komatineni <satya.komatin...@gmail.com> > wrote: >> Venkata, >> All you probably need is an activity. May be just the activity that >> you are on when the menu is clicked. >> >> Eitherway on the menu click start an asynctask and you can show the >> progress bar while the asynctask is in progress. >> >> At the end of that asynctask you can update the view in your activity >> with the data. Or you can start a new actvity first and have that new >> activity start an async task. >> >> >> >> >> >> >> >> >> >> On Fri, May 6, 2011 at 2:44 PM, venkata raidu <venkata.ra...@gmail.com> >> wrote: >> > Problem: >> > I need to display a dialog upon the click of a menu item. The >> > information to be displayed on the dialog will be downloaded each time >> > and is a lengthy process. How do you solve this problem, so that a >> > progress bar is displayed during this process. >> >> > Solution I tried: >> > I used onCreateDialog() of the Activity and wrote a class which >> > extends AsyncTask to create a dialog with new data. But in the method >> > onCreateDialog(), it waits for a dialog to be returned, and I was not >> > able to send using my class because onPostExecute() method's return >> > type is void. >> >> > Please suggest a solution. Thanks. >> >> > -Venkata >> >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Android Developers" group. >> > To post to this group, send email to android-developers@googlegroups.com >> > To unsubscribe from this group, send email to >> > android-developers+unsubscr...@googlegroups.com >> > For more options, visit this group at >> >http://groups.google.com/group/android-developers?hl=en >> >> -- >> Satya Komatinenihttp://www.satyakomatineni.comhttp://www.androidbook.com > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Satya Komatineni http://www.satyakomatineni.com http://www.androidbook.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en