版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。 https://blog.csdn.net/qingfeng812/article/details/70916119
異常名稱
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
日志截圖:
根據友盟閃退日志截圖:

原因歸納
有同僚把.Builder()中的Context寫成了getApplicationContext()引發的錯誤
正确寫法需要傳遞目前activity的Context對象。而不是全局的Context。
正确寫法:
new AlertDialog
.Builder(PlatWDdetailyActivity.this)
.setTitle("溫馨提示")
.setMessage("\t\t确認反送出該條單據?")
.setNegativeButton("取消", null)
.setPositiveButton("确認", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String retype = "reforsub";
doresubmit(retype);
}
}).show();