Questions tagged [android-windowmanager]

The Android WindowManager is a system service, which is responsible for managing the z-ordered list of windows, which windows are visible, and how they are laid out on screen.

The Android WindowManager is a system service, which is responsible for managing the z-ordered list of windows, which windows are visible, and how they are laid out on screen.

Check the official WindowManager documentation for more details on the contract interface.

565 questions
309
votes
16 answers

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$BadTokenException: Unable to add window -- token null is…
233
votes
3 answers

What APIs are used to draw over other apps (like Facebook's Chat Heads)?

How does Facebook create the Chat Heads on Android? What is the API to create the floating views on top of all other views?
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
134
votes
12 answers

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: Unable to add window -- token null is not for…
michael
  • 106,540
  • 116
  • 246
  • 346
96
votes
16 answers

Android: Unable to add window. Permission denied for this window type

I'm working on an app where I need to display a window with some info ON the Lock Screen (KeyGuard) without unlocking the phone. I figured I could probably do it with WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG But every time my app crashes with…
DroidPilot
  • 993
  • 1
  • 7
  • 8
76
votes
4 answers

Android activity over default lock screen

How can I display an Activity or Dialog to be visible over the lock screen? I have already tried displaying my lock activity when screen turns on by setting various window type in Activity.onCreate() method: …
plugmind
  • 7,926
  • 4
  • 34
  • 39
70
votes
3 answers

What is WindowManager in android?

I tried googling it and there is no direct and/or clear cut answer. The developer website's definition is not clear either: The interface that apps use to talk to the window manager. Use Context.getSystemService(Context.WINDOW_SERVICE) to get one…
tony9099
  • 4,567
  • 9
  • 44
  • 73
31
votes
1 answer

Caught a RuntimeException from the binder stub implementation when swap data in arrayadapter

public class MainActivity extends AppCompatActivity { ArrayList list = new ArrayList<>(); ArrayAdapter adapter; ArrayList data1 = new ArrayList<>(); ArrayList data2 = new…
22
votes
6 answers

Android: permission denied for window type 2038 using TYPE_APPLICATION_OVERLAY

I trying to create a view that is above other applications: WindowManager.LayoutParams paramsDirectorView = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, …
Derwrecked
  • 771
  • 1
  • 6
  • 17
22
votes
5 answers

IllegalArgumentException: Window type can not be changed after the window is added

I've tried the advice here, the advice here, the advice here, I've commented out the onAttachedToWindow() in my Base Activity. I have two Activities inheriting from this class, BaseActivity. One runs, and one does not. What could be the…
Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106
22
votes
1 answer

what does exception java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@4205eb18 does not exist mean

I am trying to login into the app but after the login is success and it is about to go to next screen, it restarts. Following is the exception that I guess would have caused this, as there is no other exception. 11-14 15:09:54.841:…
21
votes
6 answers

Android O - FLAG_SHOW_WHEN_LOCKED is deprecated

I'm targetting my application to Android O. In my application I have a job service that shows a window over all other applications, so when it triggered it needs to show this window even when the screen is turned off & unlocked and turn it on. I've…
Elior
  • 3,178
  • 6
  • 37
  • 67
21
votes
0 answers

TYPE_TOAST alternative that will not request permission?

I'm working on an SDK that is putting a popup view on the WindowManager using the TYPE_TOAST LayoutParams type. The last version of Android Nougat (7.1.1) made some change to the WindowManager (I don't know yet what change exactly - would be…
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
20
votes
3 answers

Alternative to "FLAG_BLUR_BEHIND" in Android?

I can see that when I use the same flag as shown on the API-demos for blurring the background, I get a warning that it's deprecated: "The field WindowManager.LayoutParams.FLAG_BLUR_BEHIND is deprecated". I've read about it, and I've found that…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
19
votes
5 answers

Keeping track of View added to WindowManager (no findViewById() function?)

In my service I add a view to WindowManager with addView(). When I'm ready to hide the view, I call removeView() using the View reference. This works great -- most of the time. I have occasional Force Close reports that say that the View is not…
Jesta
  • 1,387
  • 2
  • 9
  • 9
18
votes
2 answers

Is it possible to always show the action bar when using adjustPan as soft input mode?

In my application I have a ListView with a footer that contains a custom view with an EditText inside. At the top sits an action bar. The activity currently uses SOFT_INPUT_ADJUST_RESIZE (adjustResize) as soft input mode and does not close the…
1
2 3
37 38