Hello,
in my android application at some event in an activity I want to ask
the user for a name (string). I know how to do this: call showDialog,
create the dialog in the Activity.onCreateDialog method (I need to
supply a string for the label) and handle the result in the onClick of
the dialog. This works fine and to my satisfaction.
BUT doing it this way I have three different places (onCreateDialog,
onClick, and where I call ShowDialog), where this simple task spreads
throughout the code of my activity. I would much more prefer to keep
this code together, to write something like this:

string result;
if (showSimpleEditDialog(idForLabelString, result)==DIALOG_OK)
{
   // do something with the result
}

or maybe with a class instance

SimpleEditDialog dlg = new SimpleEditDialog(idForLabelString);
if (dlg.showModal()==DIALOG_OK)
{
   string result = dgl.getResult();
   // do something with the result
}

 (The "idForLabelString" would be some resource id for the label to
use, "DIALOG_OK" would be some constant returned when the user clicks
OK) I know, I would have to write this methodes or this class. But for
better readibility of my code I would do it. Any suggestions?
Thank you,
Gerhard

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to