我想通过当密码验证完成后显示在PasswordUnlockScreen.java文件的Toast通知修改的Android框架。我已经添加了code以下行verifyPasswordAndUnlock()
Toast.makeText(getApplicationContext(),验证密码,Toast.LENGTH_LONG).show();
不过,我得到的生成错误:
frameworks/base/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java:166:找不到符号符号:方法getApplicationContext() 位置:类com.android.internal.policy.impl.PasswordUnlockScreen Toast.makeText(getApplicationContext(),验证密码,Toast.LENGTH_LONG).show();
我应该为背景,而不是getApplicationContext()?
使用谢谢!
解决方案试试这个:
Toast.makeText(PasswordUnlockScreen.this,验证密码,Toast.LENGTH_LONG).show();
I'm trying to modify the Android framework by displaying an Toast notification in the PasswordUnlockScreen.java file when a password verification is done. I've added the following line of code in verifyPasswordAndUnlock()
Toast.makeText(getApplicationContext(), "Verifying password", Toast.LENGTH_LONG).show();
However, I get the build error:
frameworks/base/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java:166: cannot find symbol symbol : method getApplicationContext()
location: class com.android.internal.policy.impl.PasswordUnlockScreen
Toast.makeText(getApplicationContext(), "Verifying password", Toast.LENGTH_LONG).show();
What should I use as the context instead of getApplicationContext()?
Thanks!
解决方案Try this one :
Toast.makeText(PasswordUnlockScreen.this, "Verifying password", Toast.LENGTH_LONG).show();