-1

I am new to development of android and i don't have a fair idea how to read logcat. I am trying to develop android webview application but ran into these errors.

E/AndroidRuntime:  FATAL EXCEPTION: main
E/AndroidRuntime:  Process: com.tech.neucial, PID: 25698
E/AndroidRuntime:  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tech.neucial/com.tech.neucial.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setHomeButtonEnabled(boolean)' on a null object reference
E/AndroidRuntime:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2329)
E/AndroidRuntime:   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
E/AndroidRuntime:   at android.app.ActivityThread.access$900(ActivityThread.java:147)
E/AndroidRuntime:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
E/AndroidRuntime:   at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime:   at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime:   at android.app.ActivityThread.main(ActivityThread.java:5256)
E/AndroidRuntime:   at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime:   at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
E/AndroidRuntime:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
E/AndroidRuntime:  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setHomeButtonEnabled(boolean)' on a null object reference
E/AndroidRuntime:   at com.tech.neucial.MainActivity.onCreate(MainActivity.java:39)
E/AndroidRuntime:   at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime:   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282)
E/AndroidRuntime:   ... 10 more

I have tried every possible way to understand but no resolve. Here is the source code. https://www.mediafire.com/?28yu5r0y7o19383

PS: i am uploading whole source because i don't know which file has cause the issue and there have been 5 or 6 files which i can't paste here.

Thanks.

Robert
  • 39,162
  • 17
  • 99
  • 152
Mustansir
  • 37
  • 9
  • Post the logcat directly in the post and same with the relevant parts of your source code. Links are useless in the future if they cease to work. If your having trouble narrowing down the source, just post the logs for now. – Kalel Wade Apr 02 '15 at 17:11
  • Ok thanks Ill remember it from now. – Mustansir Apr 03 '15 at 09:52

1 Answers1

0

Use getSupportActionBar() method instead of getActionBar() inside onCreate of MainActivity

abhishesh
  • 3,246
  • 18
  • 20