我正在尝试通过在密码验证完成时在PasswordUnlockScreen.java文件中显示Toast通知来修改Android框架。我在verifyPasswordAndUnlock()
中添加了以下代码行Toast.makeText(getApplicationContext(), "Verifying password", Toast.LENGTH_LONG).show();
但是,我收到了构建错误:
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();
我应该使用什么作为上下文而不是getApplicationContext()?
谢谢!
答案 0 :(得分:0)
试试这个:
Toast.makeText(PasswordUnlockScreen.this, "Verifying password", Toast.LENGTH_LONG).show();