Tuesday, September 18, 2012

[android-developers] Displaying a Toast notification in Password Unlock Screen

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 the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate