pri*_*nce 2 android toast android-ui android-toast
我试图使用以下代码在我的应用程序中显示一个Toast消息.
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Do you want to continue?");
alert.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
try{
//This code generates an Activity Not Found exception
}
catch(ActivityNotFoundException e) {
System.out.println("Activity Not Found Exception Raised");
Toast.makeText(getBaseContext(), "Activity Not Found", Toast.LENGTH_LONG).show(); // For the context I tried using getBaseContext, ActivityName.this also
}
}
});
alert.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert.show();
Run Code Online (Sandbox Code Playgroud)
但是这条消息仅在少数设备上显示.我已经在HTC One X上测试了这个代码,Android版本4.2.2正在运行.
如果我在Micromax A63上测试同样的代码,它也有Android 4.2.2,但它不适用于它.
我在互联网上搜索了这种错误,他们主要是在设置菜单中告诉应用程序通知禁用选项.但我的应用程序通知未被禁用.
编辑
我在里面做的 AlertDialog
有人可以帮我解决这个问题.
ran*_*ows 15
如果您还没有想到这一点,请确保您没有禁用相关应用程序的通知; 这也禁用了祝酒词.
https://code.google.com/p/android/issues/detail?id=35013
| 归档时间: |
|
| 查看次数: |
6380 次 |
| 最近记录: |