Hi all,
I'm trying to display pop-up alert when user clicks on menu option that has
not been implemented yet (this is "try it" app so please do not tell me that
I should hide or disable the opt). The dialog gets built fine but on
dlg.show() I get the following exception
android.view.WindowManager$BadTokenException: Unable to add window -- token
null is not for an application
Here's calling code from Activity#onOptionsItemSelected
case R.id.report_menu_3days:
ReportUtils.alert(getBaseContext(),
R.string.err_not_implemented);
return super.onOptionsItemSelected(item);
And here's ReportUtils#alert method
public static void alert(Context context, int messageId) {
Builder bldr = new
AlertDialog.Builder(context).setTitle(messageId).setCancelable(true);
OnClickListener listnr = new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
};
bldr.setPositiveButton("OK", listnr);
bldr.show();
}
I suspect that I'm getting this since by the time bldr#show() is called I'm
still within a menu UI but how do I do it otherwise?
Bob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---