0

I have an activity where i defined sliding panel and when i go to different activity i always get NullPointerException. So, how can i make this work?

onCreate:

 @Override
protected void onCreate(final Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    // Load the music browser fragment
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.activity_base_content, new MusicBrowserPhoneFragment()).commit();
    }

    preProcessingPanel();


    mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);

    mLayout.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {...}

LOG CAT:

10-04 21:08:46.951  22229-22229/com.andrew.apollo E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andrew.apollo/com.andrew.apollo.ui.activities.ProfileActivity}: java.lang.NullPointerException
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
        at android.app.ActivityThread.access$600(ActivityThread.java:130)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4745)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.NullPointerException
        at com.andrew.apollo.ui.activities.BaseActivity.setQueueFragment(BaseActivity.java:247)
        at com.andrew.apollo.ui.activities.BaseActivity.onCreate(BaseActivity.java:291)
        at com.andrew.apollo.ui.activities.ProfileActivity.onCreate(ProfileActivity.java:109)
        at android.app.Activity.performCreate(Activity.java:5008)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)

           

  • http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it – ben75 Oct 04 '14 at 15:41
  • @ben75, thank you, but it is not what i'm looking for... i just want to know is there any ways to make sliding layout over all the activities, like NavDrawer, but on bottom – Happiest Gabbler Oct 04 '14 at 16:08
  • So reformulate your question, because at it is now it really sound like : "I've an error, I can't fix it." – ben75 Oct 04 '14 at 16:13
  • When i change activity, app crashes, because the sliding up panel defined in one activity, but when i change my activity, app crashes – Happiest Gabbler Oct 04 '14 at 16:23
  • did you read the link in my first comment ? Is there something you don't understand in this linked post ? did you read your logcat ? why not posting your logcat here ? – ben75 Oct 04 '14 at 16:30
  • @ben75, i have posted, check it out in the topic – Happiest Gabbler Oct 04 '14 at 17:13
  • Nav drawer doesn't work across activities either. It swaps in new fragments – Andrew Kirkegaard Oct 04 '14 at 17:19
  • can you indicate the line causing the error ? – ben75 Oct 04 '14 at 17:23
  • @ben75, i think there is no way, i must make a fragment instead of activity.. because i can use viewpager in one activity and just set different fragments to it, and sliding up panel will be over the layout – Happiest Gabbler Oct 04 '14 at 18:44

0 Answers0