Reputation: 71
My end goal is to use WindowManager and add views to it that will persist across my entire app (without using TYPE_SYSTEM_OVERLAY
that requires a special permission from the user in API >=23).
What I do currently is this:
currentActivity.getWindowManager()
wm.addView(..)
to all the windows that were added before.However, no matter what I do the windows never get added when calling addView
, its like the window manager just ignores that call..
I am using TYPE_APPLICATION for the windows.
I tried using currentActivity.getSystemService(WINDOW_MANAGER)
instead of currentActivity.getWindowManager()
Can anybody tell why?
Upvotes: 1
Views: 1159
Reputation: 71
Contrary to all beliefs TYPE_APPLICATION_ATTACHED_WINDOW
or TYPE_APPLICATION
or anything that with the word APPLICATION
in it (which makes sense by the way) is NOT the way to go.
I have no idea why and if a Google engineer is here to answer that would be great but the solution is to use TYPE_TOAST
(?!?!?)
Also make sure you get a new WindowManager
instance from the new activity when switching between activities so if you add windows or remove them it is a valid instance.
Thanks about it.. 4 hours wasted over naming conventions and lack of good documentation :)
Upvotes: 1