E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.administrator.phonedial, PID: 3406 java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference at com.example.administrator.phonedial.MainActivity$MyClickListener.onClick(MainActivity.java:51) at android.view.View.performClick(View.java:5610) at android.view.View$PerformClick.run(View.java:22260) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
2 回答
Kamey
TA贡献20条经验 获得超4个赞
写了findViewById的话,再看看id名是不是那个EditText,以及是不是在对应的Activity里findViewById的,如果不是在Activity写的就看看parentView获取对没有。
- 2 回答
- 0 关注
- 2142 浏览
添加回答
举报
0/150
提交
取消