On Thu, Aug 5, 2010 at 3:42 AM, livinberlin <[email protected]> wrote:
> Both functions only have a single int parameter (dialog id).
>
No - only onCreateDialog does. onPrepareDialog also passes you the Dialog
it's preparing ... otherwise it would be rather useless.
> For example, consider an alert dialog that shows the number of files
> in a folder. The message could be "Number of files: 15" or "Number of
> files: 21". How can I pass this message string over to onCreateDialog
> or onPrepareDialog?
>
Store the number of files somewhere in the activity, and in onPrepareDialog,
which, again, gives you the Dialog, call dialog.setMessage("Number of file:
" + numberOfFiles);
> A solution would be to store my message string in a member variable of the
> activity before calling showDialog, and reading that member variable in
> onCreateDialog/onPrepareDialog. But this could cause problems when calling
> showDialog multipe times, because onCreateDialog/ onPrepareDialog are called
> asynchronously.
>
Where does it say these functions are called asynchronously? Anything
dealing with any UI elements (like a Dialog) is pretty much guaranteed to be
running on the UI thread.
-------------------------------------------------------------------------------------------------
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 [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