I'm trying to display a Toast notification in verifyPasswordAndUnlock() in PasswordUnlockScreen.java whenever a user enters the wrong password. I wrote the following code, and built successfully.
Toast.makeText(getContext(), "Invalid password", Toast.LENGTH_LONG).show();
However, the Toast doesn't appear, because it actually appears in the home screen, which is invisible when the lock screen is on top. I verified this by having another Toast appear when the user successfully logs in, and that Toast only appears in the home screen after the Lock screen disappears
I suspect this is because getContext() returns the home screen's context. How do I get the Lockscreen's context? PasswordUnlockScreen.this doesn't even compile, and mContext and context both have the same problem as getContext()
--
You received this message because you are subscribed to a topic in the Google Groups "android-platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-platform/GWKoP56CM6c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
The unlock screen aka keyguard in Android is a special window. The toast is a special window, too. You can find that keyguard belongs to systemui, which has the higher privilege/layer than toast (check out this in WindowManager.java), and there are some codes in WindowManagerService to make sure systemui shows on the top.
My solution is to give up toast and use a view instead.
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.