This question has already been answered:
What could be the problem?
FATAL EXCEPTION: main Process: com.happ, PID: 24333 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.happ/com.happ.controllers.FeedActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.happ.controllers.FeedActivity.onCreate(FeedActivity.java:182) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Here swears on this line:
navigationView.getMenu().findItem(R.id.nav_item_feed).setChecked(true); Here is the markup:
<android.support.design.widget.NavigationView xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/navigation_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:overScrollMode="ifContentScrolls"> <android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" app:headerLayout="@layout/drawer_header"/> <android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" app:menu="@menu/drawer"/> </android.support.design.widget.NavigationView> PS I still need to figure out how to properly substitute a menu drawer under the drawer_header . I just want to insert a ViewPager between the menu drawer and the drawer_header ViewPager . Do not tell RelatievLayout how this can be done in NavigationView , to substitute the functions below and above as in RelatievLayout .
activitycode. - post_zeewеще один вопросyourеще один вопросinto a separate question as it should be - Vladyslav Matviienko