mopabio.blogg.se

Android java permissions windowmanager addview
Android java permissions windowmanager addview











9 years, 5 months ago /guide/topics/ui/dialogs.html has been fixed (since a while).

android java permissions windowmanager addview

So to get the context inside your class where you are trying to show the dialog but not extending the Activity you can use the getParent() which returns you the context of that superior activity. Context mContext = getApplicationContext() Dialog dialog = new Dialog(mContext) Your fix leads to Dialog dialog = new Dialog(this) Which works! Thanks 9 years, 9 months ago Possible duplicate of Android 1.6: "$BadTokenException: Unable to add window - token null is not for an application" 9 years, 7 months ago Why use getParent()?, what's mean? 9 years, 7 months ago When you are showing any dialog in another class that does not extend the Activity class so you may not get the context of that class that is extending the Activity.

android java permissions windowmanager addview

10 years ago The android docs ( /guide/topics/ui/dialogs.html#CustomDialog) for creating a custom dialog have this error. 10 years, 7 months ago Then mContext should be MyActivity.this. But I did not use new Dialog(getApplicationContext()) I only use ' new AlertDialog.Builder(mContext) ' where mContext is a referent to an activity. 1 year, 5 months ago Related Topics android runtimeexception android-dialog android-windowmanager Comments 10 years, 11 months ago How are we supposed to know without posting some code? 10 years, 11 months ago Thanks.













Android java permissions windowmanager addview