Linked Questions
42 questions linked to/from Dialog throwing "Unable to add window — token null is not for an application” with getApplication() as context
2 votes
1 answer
3k views
I want to open dialog box when i click on ImageView in Recyclerview [duplicate]
I want to open dialog box when i click on ImageView in Recyclerview. When i show Toast it's working(Showing) but when i want to show AlertDialog Box it's not working (on image click application ...
0 votes
1 answer
3k views
Dialog throwing "Unable to add window — token null is not for an application” [duplicate]
My code: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R....
-3 votes
3 answers
1k views
Unable to show alert dialog-android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application [duplicate]
I am trying to check internet connectivity from broadcast receiver and if there is not internet want to show an alert dialog but here I receives an error ablove mentioned due to AlertDialog.Builder(...
1 vote
5 answers
263 views
App crashed when try to display dialog box [duplicate]
Just a simple things, the app should shows dialog box when button is clicked. But when it is clicked, it crashed. And I don't understand what are the logCat error trying to said. addImage....
0 votes
3 answers
1k views
Create dialog box with 2 radio buttons inside [duplicate]
I want to create a dialog box when a button is clicked inside the dialog box I need 2 radio buttons which are linked with mobile default music and other is external memory of the mobile. Anyone can ...
3 votes
2 answers
227 views
AlertBuilder showing an exception. DialogBox is not opening [duplicate]
In the following code I want to open the dialog box when the mIndex is 0. The code is going in the 'if' part. But is not opening the dialog Box instead showing the following exception. Code: ...
0 votes
0 answers
150 views
Android Bottomsheet Dialog on List Item Click [duplicate]
I am displaying some data in a recycler listview based on retrofit post back data.It is working,Now I am trying to show a Bottom sheet dialog on Listview ItemClick.For this I have implemented item ...
0 votes
1 answer
139 views
Android alert dialog error [duplicate]
I am trying to create an alert dialog popup and have tried several different methods, they all result in this error. "android.view.WindowManager$BadTokenException: Unable to add window -- token null ...
309 votes
16 answers
201k views
Android 1.6: "android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application"
I'm trying to open a dialog window, but every time I try to open it it throws this exception: Uncaught handler: thread main exiting due to uncaught exception android.view.WindowManager$...
282 votes
7 answers
87k views
When to call activity context OR application context?
I do not fully understand the activity context vs the application context. As I understand it so far, each is an instance of its class, which means that some programmers recommend you to use this....
136 votes
12 answers
146k views
Android 'Unable to add window -- token null is not for an application' exception
I get the following Android exception when I try to open a dialog. Can someone please help me understand what is going on and how can I fix this problem? android.view.WindowManager$BadTokenException: ...
111 votes
18 answers
142k views
Android: ProgressDialog.show() crashes with getApplicationContext
I can't seem to grasp why this is happening. This code: mProgressDialog = ProgressDialog.show(this, "", getString(R.string.loading), true); works just fine. However, this code: mProgressDialog = ...
135 votes
11 answers
155k views
"android.view.WindowManager$BadTokenException: Unable to add window" on buider.show()
From my main activity, I need to call an inner class and in a method within the class, I need to show AlertDialog. After dismissing it, when the OK button is pressed, forward to Google Play for ...
50 votes
11 answers
65k views
ProgressDialog : how to prevent Leaked Window
I'm using ProgressDialog to prevent the user from interacting while the device is downloading stuff from internet. everything was working fine until my client managed to produce this bug : "07-06 ...
28 votes
10 answers
83k views
Android Error: Unable to add window -- token null is not for an application
Hy. I tried to create an alert dialog but when I run my application, is throw an exception 09-26 12:43:21.949: E/AndroidRuntime(14618): FATAL EXCEPTION: main 09-26 12:43:21.949: E/AndroidRuntime(...