Android starting application after searching for i

2019-08-31 12:19发布

I installed my application through clicking run in eclipse. When I search for my application to start it and click on it I get the following error. Do I have to add some magic phrase to the manifest?

09-21 11:25:33.138: ERROR/AndroidRuntime(23360): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Questionaire/com.Questionaire.FillInput}: java.lang.NullPointerException
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.ActivityThread.access$2200(ActivityThread.java:126)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.os.Looper.loop(Looper.java:123)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.ActivityThread.main(ActivityThread.java:4595)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at java.lang.reflect.Method.invoke(Method.java:521)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at dalvik.system.NativeStart.main(Native Method)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360): Caused by: java.lang.NullPointerException
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at com.Questionaire.FillInput.onCreate(FillInput.java:94)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
09-21 11:25:33.138: ERROR/AndroidRuntime(23360):     ... 11 more
09-21 11:26:16.488: ERROR/ActivityManager(82): fail to set top app changed!

2条回答
一纸荒年 Trace。
2楼-- · 2019-08-31 12:45

the Null Pointer Exception happens when you get a null value for any objects. Please check these stuff.

  1. Resource id of the layout you mentioned are right. did you created the object for the view with the not related layout.
  2. Any null value from the getIntent() method.
查看更多
何必那么认真
3楼-- · 2019-08-31 13:07

No you don't. Take a look on that line:

com.Questionaire.FillInput.onCreate(FillInput.java:94)

it means that in the code of onCreate mthod in the FillInput Activity class (line 94) you have an object that is null that's being accessed for data (calling one of it's methods maybe ?) If unsure put the code of onCreate here with numbers on the side so i can check.

查看更多
登录 后发表回答