In my java application i have this code
@Override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); super.onAttachedToWindow(); }
when I create it for Android 2.3 (level 10) , it compiles and works fine. But when I create it for android 4.0 (level 15) , it compiles and gives me a crash at runtime and the 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 on this line and build it, it works fine and not a problem ..
//this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
so I donβt understand why this is happening and what does this code mean?
Edit: some links here
when running the application on my phone. Android Version 4.0.3
secure toddler app on Android phone
java android android-emulator android-windowmanager
Jeegar Patel Sep 24 2018-12-12T00: 00Z
source share