android-windowmanager

What does this 4 line java code means in android application?

喜你入骨 提交于 2019-11-27 15:18:27
In my java application i have this code @Override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); super.onAttachedToWindow(); } when i build it for android 2.3 (level 10) it compiles and works fine. But when i build it for android 4.0 (level 15) it compiles and gives me crash at run time and following error 07-16 14:00:03.090: E/AndroidRuntime(29487): FATAL EXCEPTION: main 07-16 14:00:03.090: E/AndroidRuntime(29487): java.lang.IllegalArgumentException: Window type can not be changed after the window is added. when i comment this

How to avoid black screen in android while my app is loading?

♀尐吖头ヾ 提交于 2019-11-27 15:05:58
问题 How to avoid black screen in android while my app is loading ? I have removed all things from onCreate to AsyncTask but still I have black screen at the beginning. My default ( first ) activity is Main and if there is one parameter I momentarily load Personal activity withou showing Main, otherwise I show Main activity. Can anyone suggest me solution ? I tried with http://blog.iangclifton.com/2011/01/01/android-splash-screens-done-right/ but it doesn't help. 回答1: i'm not sure. but, Try this

Detect Lock Screen Incorrect Password by user in Android

会有一股神秘感。 提交于 2019-11-27 13:20:05
问题 I am building a security app and I need to know if the user is giving incorrect password . Suppose user phone is locked by pattern lock system , and unfortunately user has forgotten the pattern password.When user give wrong pattern 5 time, there will be a penalty for 30 sec . I need to catch that penalty event . In my app, i have to do some task (for the safety of user) when this even come . Please help me, 回答1: You can set up a DeviceAdminReceiver that will be notified about failed password

How to add a floating view to Android Window manager and listen to System/Hardware back button events

僤鯓⒐⒋嵵緔 提交于 2019-11-27 05:38:12
问题 I have a service which displays a floating view on the window manager (using WINDOW_TYPE_ALERT permission). I'm able to display it and perform actions. But, I have two specific questions: Regarding the implementation of the floating view How to listen to system back button event so that I can dismiss the view. Implementation: In the manifest I added permissions for: <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> I have a broadcast receiver which will listen for

How to create an UI or a widget that sits on top of all applications in Android?

夙愿已清 提交于 2019-11-27 05:31:26
问题 Can I create an UI or a widget in Android that will sit on top of all applications? There are applications that have widgets like this. One example has a camera icon on top of all the applications that, when clicked, will capture the screen. 回答1: If you want to just display something, you can display it on top of everything even the lockscreen. If you want something to be clickable, you can display it on top of anything except the lockscreen. Here's a sample, modify to your needs: Create a

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

人走茶凉 提交于 2019-11-27 03:24:36
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 an application at android.view.ViewRoot.setView(ViewRoot.java:509) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.app.Dialog.show(Dialog.java:241) Peter Knego I'm guessing - are you trying to create Dialog with an application context? Something like

Alternative to “FLAG_BLUR_BEHIND” in Android?

允我心安 提交于 2019-11-26 21:09:38
问题 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 "Blurring is no longer supported". Does it mean that it won't work on future versions? Why did they deprecate it? Is there an alternative? I really like this feature. 回答1: ok , there is probably no alternative that uses the API , unless maybe i've

TYPE_SYSTEM_OVERLAY in ICS

时光总嘲笑我的痴心妄想 提交于 2019-11-26 20:17:48
In Honeycomb I was able to create a system overlay with TYPE_SYSTEM_OVERLAY and receive touches with FLAG_WATCH_OUTSIDE_TOUCH. Now ICS has changed something. I can still create the system overlay, but i can't get touches. Now, i am able to create the same with TYPE_SYSTEM_ALERT and get touches, but it just catches the touchevents, and not passing them on like in Honeycomb. Any idea's? Kind regards Everything you describe is true. It is presumably to tighten up security, as the former behavior was the source of tapjacking attacks. I wrote a blog post recently about this change. Any idea's? Don

What is WindowManager in android?

。_饼干妹妹 提交于 2019-11-26 18:50:20
问题 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 of these. Can someone with plain 6th grade English explain what it is? And how can I use it to create a floating object that remains via several activties, even though I moved from one to the other? 回答1: The Android WindowManager is a system service,

ViewPager on a view added by WindowManager getting “java.lang.IllegalArgumentException: No view found for id”

筅森魡賤 提交于 2019-11-26 17:08:49
问题 I am implementing a photo viewer which allow user to view photos in full-screen mode from a thumbnail. My current approach is adding inflated view to WindowManager . In the inflated view, there is a ViewPager allowing user switch images. And I got error "java.lang.IllegalArgumentException: No view found for id" Here is the details (a view is inflated in setActivity method and setting adapter for viewPager in openPhoto method): public class PhotoViewer { private static final String TAG =