显示在Android框架Toast通知 [英] Displaying a Toast notification in Android framework
本文介绍了显示在Android框架Toast通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过当密码验证完成后显示在PasswordUnlockScreen.java文件的Toast通知修改的Android框架。我已经添加了code以下行verifyPasswordAndUnlock()
Toast.makeText(getApplicationContext(),验证密码,Toast.LENGTH_LONG).show();
不过,我得到的生成错误:
<$p$p><$c$c>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();
这篇关于显示在Android框架Toast通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文