Re: [android-developers] Dialog dismiss()
On Thu, Sep 8, 2011 at 2:29 PM, TreKing <trekingapp@gmail.com> wrote:
> Or use showDialog() / dismissDialog().
I tried this and it's actually worse now. It crashes everytime I
rotate, not just occasionally like before.
My pattern looks like this now:
private static final int DIALOG_GAMES = 0;
final Runnable updateCurrentGames = new Runnable()
{
@Override
public void run()
{
dismissDialog( Games.DIALOG_GAMES );
updateUi();
}
};
private void getCurrentGames()
{
showDialog( Games.DIALOG_GAMES );
new Thread()
{
@Override
public void run()
{
currentGames();
handler.post( updateCurrentGames );
}
}.start();
}
@Override
protected Dialog onCreateDialog( final int id )
{
Dialog dialog = null;
switch( id )
{
case DIALOG_GAMES:
dialog = ProgressDialog.show( this, "Working . . .", "Getting
current games.." );
break;
}
return dialog;
}
@Override
protected void onDestroy()
{
super.onDestroy();
dismissDialog( Splash.DIALOG_SPLASH );
}
Also tried it without the dismissDialog() call in onDestroy().
The exceptional condition is:
09-09 20:05:12.626: ERROR/AndroidRuntime(3831): Caused by:
java.lang.IllegalArgumentException: no dialog with id 0 was ever shown
via Activity#showDialog
At this point I'm going with
setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );
It's a sure thing.
Good luck to the next guy.. I can't make it work.
--
Greg Donald
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home