-1

我从这里安装了 ViewPagerTutorial:

http://www.androidbegin.com/tutorial/android-actionbarsherlock-viewpager-tabs-tutorial/

一旦你改变方向,它就会立即崩溃。

更新:日志猫

shell@android:/ $ logcat                                                       
--------- beginning of /dev/log/system
I/ActivityManager(  379): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.androidbegin.viewpagertutorial/.MainActivity} from pid 8321
--------- beginning of /dev/log/main
D/dalvikvm(17204): Late-enabling CheckJNI
I/ActivityManager(  379): Start proc com.androidbegin.viewpagertutorial for activity com.androidbegin.viewpagertutorial/.MainActivity: pid=17204 uid=10118 gids={50118, 1028}
D/dalvikvm(  127): GC_EXPLICIT freed 40K, 1% free 8629K/8700K, paused 3ms+3ms, total 34ms
D/dalvikvm(  127): GC_EXPLICIT freed <1K, 1% free 8629K/8700K, paused 1ms+2ms, total 30ms
I/ActivityManager(  379): No longer want com.vzw.apnservice (pid 16919): empty for 1801s
D/dalvikvm(  127): GC_EXPLICIT freed <1K, 1% free 8629K/8700K, paused 1ms+3ms, total 25ms
W/ActivityManager(  379): Scheduling restart of crashed service com.vzw.apnservice/.VZWAPNService in 5000ms
D/libEGL  (17204): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
D/libEGL  (17204): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
D/libEGL  (17204): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
D/OpenGLRenderer(17204): Enabling debug mode 0
I/ActivityManager(  379): Displayed com.androidbegin.viewpagertutorial/.MainActivity: +611ms
I/ActivityManager(  379): Config changes=1480 {1.0 311mcc480mnc en_US ldltr sw360dp w598dp h335dp 320dpi nrml land finger -keyb/v/h -nav/h s.81}
I/InputReader(  379): Reconfiguring input devices.  changes=0x00000004
I/InputReader(  379): Device reconfigured: id=6, name='Melfas MMSxxx Touchscreen', size 720x1280, orientation 1, mode 1, display id 0
D/AndroidRuntime(17204): Shutting down VM
W/dalvikvm(17204): threadid=1: thread exiting with uncaught exception (group=0x412f5930)
E/AndroidRuntime(17204): FATAL EXCEPTION: main
E/AndroidRuntime(17204): java.lang.NullPointerException
E/AndroidRuntime(17204):    at android.support.v4.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManager.java:1576)
E/AndroidRuntime(17204):    at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1617)
E/AndroidRuntime(17204):    at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:481)
E/AndroidRuntime(17204):    at android.app.Activity.performSaveInstanceState(Activity.java:1147)
E/AndroidRuntime(17204):    at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1216)
E/AndroidRuntime(17204):    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3666)
E/AndroidRuntime(17204):    at android.app.ActivityThread.access$700(ActivityThread.java:141)
E/AndroidRuntime(17204):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1240)
E/AndroidRuntime(17204):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(17204):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(17204):    at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(17204):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17204):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(17204):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(17204):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(17204):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  379):   Force finishing activity com.androidbegin.viewpagertutorial/.MainActivity
D/dalvikvm(17204): GC_CONCURRENT freed 190K, 3% free 8833K/9052K, paused 2ms+1ms, total 33ms   
----------------------------------------------
4

1 回答 1

0

这是我修复它的方法:

In AndroidManifest.xml

In <activity
add:
android:configChanges="orientation|keyboardHidden"
于 2013-09-30T12:34:12.697 回答