2

我在一个片段中调用相机意图,我从另一个片段中调用这个片段,如下所示:

FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(appContext.getConentLoadFrameId(), newFragment);
transaction.addToBackStack(null);
transaction.commit(); 

然后我拍照,丢弃照片并按返回键。然后我得到一个叫做片段的异常已经激活。

我这样称呼相机意图:

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, PICK_FROM_CAMERA);

堆:

05-02 23:46:47.114: E/AndroidRuntime(10553): FATAL EXCEPTION: main
05-02 23:46:47.114: E/AndroidRuntime(10553): java.lang.RuntimeException: Unable to start activity ComponentInfo{com./com..ui.TabActivity}: java.lang.IllegalStateException: Fragment already active
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.ActivityThread.access$600(ActivityThread.java:140)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.os.Handler.dispatchMessage(Handler.java:99)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.os.Looper.loop(Looper.java:137)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.ActivityThread.main(ActivityThread.java:4898)
05-02 23:46:47.114: E/AndroidRuntime(10553): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 23:46:47.114: E/AndroidRuntime(10553): at java.lang.reflect.Method.invoke(Method.java:511)
05-02 23:46:47.114: E/AndroidRuntime(10553): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
05-02 23:46:47.114: E/AndroidRuntime(10553): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
05-02 23:46:47.114: E/AndroidRuntime(10553): at dalvik.system.NativeStart.main(Native Method)
05-02 23:46:47.114: E/AndroidRuntime(10553): Caused by: java.lang.IllegalStateException: Fragment already active
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.support.v4.app.Fragment.setArguments(Fragment.java:484)
05-02 23:46:47.114: E/AndroidRuntime(10553): at com..ui..addTab(.java:373)
05-02 23:46:47.114: E/AndroidRuntime(10553): at com..ui..addTab(.java:326)
05-02 23:46:47.114: E/AndroidRuntime(10553): at com..ui..initialiseTabHost(.java:290)
05-02 23:46:47.114: E/AndroidRuntime(10553): at com..ui..onCreate(TabActivity.java:185)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.Activity.performCreate(Activity.java:5206)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
05-02 23:46:47.114: E/AndroidRuntime(10553): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
05-02 23:46:47.114: E/AndroidRuntime(10553): ... 11 more
05-02 23:46:47.119: E/android.os.Debug(2273): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
05-02 23:46:54.784: E/AXLOG(10347): Total-CameraPreviewLoading**StartU[1367504214789]**
05-02 23:46:54.784: E/AXLOG(10347): Total-CameraUILoading(TSP)**StartU[1367504214789]**
4

0 回答 0