写个android拨号器,运行是报如下错误
04-09 01:36:33.880: E/AndroidRuntime(3689): Caused by: java.lang.NullPointerException
04-09 01:36:33.880: E/AndroidRuntime(3689): at com.example.phone.MainActivity.onCreate(MainActivity.java:30)
网上找了很久也没有找到答案,请高手指点下
代码如下:
1 package com.example.phone;
2
运行时报如下错误,求助
04-09 01:36:33.880: W/dalvikvm(3689): threadid=1: thread exiting with uncaught exception (group=0x40bcc300)
04-09 01:36:33.880: E/AndroidRuntime(3689): FATAL EXCEPTION: main
04-09 01:36:33.880: E/AndroidRuntime(3689): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.phone/com.example.phone.MainActivity}: java.lang.NullPointerException
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.ActivityThread.access$700(ActivityThread.java:131)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.os.Looper.loop(Looper.java:137)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.ActivityThread.main(ActivityThread.java:4866)
04-09 01:36:33.880: E/AndroidRuntime(3689): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 01:36:33.880: E/AndroidRuntime(3689): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 01:36:33.880: E/AndroidRuntime(3689): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-09 01:36:33.880: E/AndroidRuntime(3689): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-09 01:36:33.880: E/AndroidRuntime(3689): at dalvik.system.NativeStart.main(Native Method)
04-09 01:36:33.880: E/AndroidRuntime(3689): Caused by: java.lang.NullPointerException
04-09 01:36:33.880: E/AndroidRuntime(3689): at com.example.phone.MainActivity.onCreate(MainActivity.java:30)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.Activity.performCreate(Activity.java:5143)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-09 01:36:33.880: E/AndroidRuntime(3689): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
04-09 01:36:33.880: E/AndroidRuntime(3689): ... 11 more
java.lang.NullPointerException at com.example.phone.MainActivity.onCreate,布布扣,bubuko.com
java.lang.NullPointerException at com.example.phone.MainActivity.onCreate
原文:http://blog.csdn.net/u011570979/article/details/23227513