mCurrentState = STATE_ERROR;
+ if (!isActivityContext(getContext())) {
+ Log.w(TAG, "Unable to show alert dialog because it requires an activity context");
+ return;
+ }
+
/* Pop up an error dialog so the user knows that
* something bad has happened. Only try and pop up the dialog
* if we're attached to a window. When we're going away and no
// an Activity, given that Activity is already a subclass of ContextWrapper.
if (context instanceof ContextWrapper && !(context instanceof Activity)) {
context = ((ContextWrapper) context).getBaseContext();
+ return isActivityContext(context);
}
return context instanceof Activity;
}