我正在使用ViewPager
带有片段。当屏幕方向更改为横向时,我得到一个空指针异常。横向使用了不同的布局
例外是:
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
任何帮助将非常感激
堆栈跟踪:-
09-18 20:31:02.770: E/AndroidRuntime(32205): FATAL EXCEPTION: main
09-18 20:31:02.770: E/AndroidRuntime(32205): java.lang.RuntimeException: Unable to start activity ComponentInfo{inc.mine.Customtracker/inc.mine.Customtracker.TabsActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{inc.mine.Customtracker/inc.mine.Customtracker.ChartActivity}: java.lang.NullPointerException
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2237)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3806)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.access$700(ActivityThread.java:139)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1266)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.os.Handler.dispatchMessage(Handler.java:99)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.os.Looper.loop(Looper.java:156)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.main(ActivityThread.java:5005)
09-18 20:31:02.770: E/AndroidRuntime(32205): at java.lang.reflect.Method.invokeNative(Native Method)
09-18 20:31:02.770: E/AndroidRuntime(32205): at java.lang.reflect.Method.invoke(Method.java:511)
09-18 20:31:02.770: E/AndroidRuntime(32205): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-18 20:31:02.770: E/AndroidRuntime(32205): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-18 20:31:02.770: E/AndroidRuntime(32205): at dalvik.system.NativeStart.main(Native Method)
09-18 20:31:02.770: E/AndroidRuntime(32205): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{inc.mine.Customtracker/inc.mine.Customtracker.ChartActivity}: java.lang.NullPointerException
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.startActivityNow(ActivityThread.java:1992)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:706)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.widget.TabHost.setCurrentTab(TabHost.java:350)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.widget.TabHost.addTab(TabHost.java:240)
09-18 20:31:02.770: E/AndroidRuntime(32205): at inc.mine.Customtracker.TabsActivity.addTab(TabsActivity.java:59)
09-18 20:31:02.770: E/AndroidRuntime(32205): at inc.mine.Customtracker.TabsActivity.setTabs(TabsActivity.java:36)
09-18 20:31:02.770: E/AndroidRuntime(32205): at inc.mine.Customtracker.TabsActivity.onCreate(TabsActivity.java:30)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.Activity.performCreate(Activity.java:4543)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
09-18 20:31:02.770: E/AndroidRuntime(32205): ... 12 more
09-18 20:31:02.770: E/AndroidRuntime(32205): Caused by: java.lang.NullPointerException
09-18 20:31:02.770: E/AndroidRuntime(32205): at inc.mine.Customtracker.ChartFragment.onCreateView(ChartFragment.java:64)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1065)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1844)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:519)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1195)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.Activity.performStart(Activity.java:4553)
09-18 20:31:02.770: E/AndroidRuntime(32205): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-18 20:31:02.770: E/AndroidRuntime(32205): ... 24 more