Monday, March 26, 2012

Android Tip: android.view.WindowManager$BadTokenException

If you are using an ActivityGroup to display a series of activities, then you may encounter the infamous BadTokenException.

The location where you are getting the exception, will have a "this" usage for the context.

To get over this error, use "this.getParent()".

Eg:  final ProgressDialog pbarDialog = new ProgressDialog( this.getParent() );
 

1 comment: