0

I have to make a dialog with 2 editfields and a process which will be handled in AsyncTask on a button click. I found that I can add editfields in alertdialog and work out. My queries are :

1) In the AsyncTask process, I will also have to show a ProgressDialog. Can I show a ProgressDialog on top of AlertDialog ?

2) To make coding simple and easy, I would prefer if I can extend AlertDialog. Is it possible to extend AlertDialog or should I extend AlertDialog.Builder ? I am confused with this state.

3) In whichever button presses, eventually the dialog will be closed, but need to run AsyncTask on positive button. Is it fine to work like this with an AlertDialog !

4) Will AlertDialog also handle the orientation part on its own like Landscape or portrait as it is supposed to do.

Any help, guidance with this can be helpful.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Tvd
  • 4,463
  • 18
  • 79
  • 125

1 Answers1

1

1) In the AsyncTask process, I will also have to show a ProgressDialog. Can I show a ProgressDialog on top of AlertDialog ?

No, see: alert dialog not appearing in android I don't get why you would need to? perhaps it's best to rethink what you're trying to achieve. There's always another, better way which will allow you to do everything you want to.

2) To make coding simple and easy, I would prefer if I can extend AlertDialog. Is it possible to extend AlertDialog or should I extend AlertDialog.Builder ? I am confused with this state.

You can create custom alert dialogs. This is what you should do. How to implement a custom AlertDialog View

For information about creating custom dialogs in general check.. http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

3) In whichever button presses, eventually the dialog will be closed, but need to run AsyncTask on positive button. Is it fine to work like this with an AlertDialog !

Hm, could you expand on what you mean here?

4) Will AlertDialog also handle the orientation part on its own like Landscape or portrait as it is supposed to do.

Orientation changes will be handled by the dialog itself. No need to worry about that.

Community
  • 1
  • 1
Aidanc
  • 6,921
  • 1
  • 26
  • 30
  • I have already created a custom dialog. Today I read reg oriantation, "onSave...()", etc which says its better to use Andriod dialogs wherever possible and avoid custom dialogs. So was thinking to transfer my custom dialog to alertdialog. I can create Custom AlertDialog, but if I can't show ProgressDialog on it, then it makes no sense for me to transfer to AlertDialog. Due to these factors I am looking for some proper solutions. – Tvd Apr 16 '11 at 16:41
  • It is a Login dialog. So on Login" button click I got to perform several tasks including calling WEb Services, etc. Hence I use these all activities to be performed via an AsyncTask object. – Tvd Apr 16 '11 at 16:54