我正在尝试使用下面的代码设置一个警报对话框,但应用程序在这一点上不断崩溃。有什么明显的错误吗?
AlertDialog alertDialog = new AlertDialog.Builder(
Crossword1.this).create();
alertDialog.setTitle("Well done, the crossword is complete!");
alertDialog.setMessage("well done cuz");
alertDialog.setIcon(R.drawable.tick);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
alertDialog.show();
下面的 Logcat 提到了内存,尽管我不明白为什么 alertdialog 框会导致内存错误(如果 alertdialog 被注释掉,应用程序运行良好)
12-21 17:57:33.180: D/BounceScrollRunnableDefault(24966): start(1554.2593), mBounceExtent:0.0
12-21 17:57:33.180: D/BounceScrollRunnableDefault(24966): mBounceExtentCoef = -205.16223
12-21 17:57:34.335: D/BounceScrollRunnableDefault(24966): start(0.0), mBounceExtent:-11.0
12-21 17:57:34.335: D/BounceScrollRunnableDefault(24966): mBounceExtentCoef = -11.0
12-21 17:57:34.555: D/BounceScrollRunnableDefault(24966): start(0.0), mBounceExtent:-19.245642
12-21 17:57:34.555: D/BounceScrollRunnableDefault(24966): mBounceExtentCoef = -19.245642
12-21 17:57:35.505: I/dalvikvm-heap(24966): Clamp target GC heap from 65.159MB to 64.000MB
12-21 17:57:35.505: D/dalvikvm(24966): GC_FOR_ALLOC freed 580K, 2% free 64467K/65479K, paused 20ms
12-21 17:57:35.505: I/dalvikvm-heap(24966): Forcing collection of SoftReferences for 2903056-byte allocation
12-21 17:57:35.545: I/dalvikvm-heap(24966): Clamp target GC heap from 65.151MB to 64.000MB
12-21 17:57:35.545: D/dalvikvm(24966): GC_BEFORE_OOM freed 9K, 2% free 64458K/65479K, paused 27ms
12-21 17:57:35.545: E/dalvikvm-heap(24966): Out of memory on a 2903056-byte allocation.