申请时出现以下错误!!
03-22 03:09:54.720: D/dalvikvm(1622): GC_EXTERNAL_ALLOC freed 47K, 49% free 2770K/5379K, external 0K/0K, paused 119ms
03-22 03:09:54.830: W/dalvikvm(1622): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
03-22 03:09:54.830: E/AndroidRuntime(1622): FATAL EXCEPTION: main
03-22 03:09:54.830: E/AndroidRuntime(1622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.idm/com.example.idm.MainActivity}: java.lang.ClassCastException: android.widget.GridView
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.os.Looper.loop(Looper.java:130)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.ActivityThread.main(ActivityThread.java:3691)
03-22 03:09:54.830: E/AndroidRuntime(1622): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 03:09:54.830: E/AndroidRuntime(1622): at java.lang.reflect.Method.invoke(Method.java:507)
03-22 03:09:54.830: E/AndroidRuntime(1622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
03-22 03:09:54.830: E/AndroidRuntime(1622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
03-22 03:09:54.830: E/AndroidRuntime(1622): at dalvik.system.NativeStart.main(Native Method)
03-22 03:09:54.830: E/AndroidRuntime(1622): Caused by: java.lang.ClassCastException: android.widget.GridView
03-22 03:09:54.830: E/AndroidRuntime(1622): at com.example.idm.MainActivity.onCreate(MainActivity.java:25)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
03-22 03:09:54.830: E/AndroidRuntime(1622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-22 03:09:54.830: E/AndroidRuntime(1622): ... 11 more
03-22 03:09:56.870: I/dalvikvm(1622): threadid=4: reacting to signal 3
03-22 03:09:56.880: I/dalvikvm(1622): Wrote stack traces to '/data/anr/traces.txt'
03-22 03:13:08.740: I/dalvikvm(2078): threadid=4: reacting to signal 3
03-22 03:13:08.740: I/dalvikvm(2078): Wrote stack traces to '/data/anr/traces.txt'
03-22 03:13:20.050: D/dalvikvm(2154): GC_EXTERNAL_ALLOC freed 45K, 49% free 2770K/5379K, external 0K/0K, paused 32ms
03-22 03:13:20.110: W/dalvikvm(2154): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
03-22 03:13:20.110: E/AndroidRuntime(2154): FATAL EXCEPTION: main
03-22 03:13:20.110: E/AndroidRuntime(2154): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.idm/com.example.idm.MainActivity}: java.lang.ClassCastException: android.widget.GridView
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.os.Looper.loop(Looper.java:130)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.ActivityThread.main(ActivityThread.java:3691)
03-22 03:13:20.110: E/AndroidRuntime(2154): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 03:13:20.110: E/AndroidRuntime(2154): at java.lang.reflect.Method.invoke(Method.java:507)
03-22 03:13:20.110: E/AndroidRuntime(2154): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
03-22 03:13:20.110: E/AndroidRuntime(2154): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
03-22 03:13:20.110: E/AndroidRuntime(2154): at dalvik.system.NativeStart.main(Native Method)
03-22 03:13:20.110: E/AndroidRuntime(2154): Caused by: java.lang.ClassCastException: android.widget.GridView
03-22 03:13:20.110: E/AndroidRuntime(2154): at com.example.idm.MainActivity.onCreate(MainActivity.java:25)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
03-22 03:13:20.110: E/AndroidRuntime(2154): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-22 03:13:20.110: E/AndroidRuntime(2154): ... 11 more
03-22 03:13:25.470: I/dalvikvm(2154): threadid=4: reacting to signal 3
03-22 03:13:25.470: I/dalvikvm(2154): Wrote stack traces to '/data/anr/traces.txt'
03-22 03:13:27.190: I/Process(2154): Sending signal. PID: 2154 SIG: 9
更新:
setContentView(R.layout.activity_main);
Button add = (Button) findViewById(R.id.button1);
add.setOnClickListener(this);
pause = (Button) findViewById(R.id.button2);
pause.setOnClickListener(this);
GridView g = (GridView) findViewById(R.id.gridView1);
g.setAdapter(new view(this));
TextView text = (TextView) findViewById(R.id.textView2);
text.setTextColor(Color.WHITE);