vijay

welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Thursday, August 9, 2012

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application


android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application


I got this error when I had been working one of my android project..This error occurs due to I declare the dialog box should like below..

Dialog dialog =new Dialog(getApplicationContext());

Here I am using getApplicationContext() its denotes the context of whole application,due to mention this I got the error.
To solve this issues you need to mention like below..

Dialog dialog =new Dialog(st.this);

Here st denotes my activity, we have to declare the activity context to dialog.Now you can run the project it will work superbly.

0 comments:

Post a Comment