Android 'Unable to add window -- token null is not for an application' exception

The Solution to Android 'Unable to add window -- token null is not for an application' exception is


I'm guessing - are you trying to create Dialog with an application context? Something like this:

new Dialog(getApplicationContext());

This is wrong. You need to use an Activity context.

You have to try like:

new Dialog(YourActivity.this);

~ Answered on 2011-10-28 18:32:52


Most Viewed Questions: