Re: [android-developers] Coding style for modal dialog

2011-05-03 Thread TreKing
On Mon, May 2, 2011 at 9:08 AM, GerhardS ghofm...@sofa.de wrote:

 Any suggestions?


Not really, unfortunately. I think the Android dialog scheme is as it is on
purpose, though I too am not a fan. I think some things have changed with
3.0 with DialogFragments from reading this forum, but I have not
investigated this myself. Might be worth looking into.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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

Re: [android-developers] Coding style for modal dialog

2011-05-03 Thread Dianne Hackborn
DialogFragment is a cleaner way to do this, putting all of the dialog
related code in a separate class instead of callbacks on Activity.  You can
use this with the fragment compat library on older platforms.  You still
can't do a blocking call to wait a result, however; your activity will need
to have a separate callback to receive the result.

On Tue, May 3, 2011 at 1:47 PM, TreKing treking...@gmail.com wrote:

 On Mon, May 2, 2011 at 9:08 AM, GerhardS ghofm...@sofa.de wrote:

 Any suggestions?


 Not really, unfortunately. I think the Android dialog scheme is as it is on
 purpose, though I too am not a fan. I think some things have changed with
 3.0 with DialogFragments from reading this forum, but I have not
 investigated this myself. Might be worth looking into.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices


  --
 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




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

[android-developers] Coding style for modal dialog

2011-05-02 Thread GerhardS

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 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