解決方法:因為此app只打算直式使用,所以manifest加入
<activity android:name="xxx.xxx.YourFragmentActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize"/>
It's my first time to use the function of supportv4 TabManager TabHost to make fragments. When calling the camera and back to the fragment, the error "java.lang.IllegalStateException: Fragment already added:" may occurs. There are many discussion about this error, but few about this case. After trying for hours, I suppose the reason is: The default android camera is landscape. After taking a picture, the picture may automatically rotates +-90 degree(even the auto rotation is off). When back to a fragment, the picture rotates -+90 degree again. supportv4 may make a wrong decision to add all the fragment back and error occurs.
Solution:Since this app is design for portrait mode, add these in manifest
<activity android:name="xxx.xxx.YourFragmentActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize"/>
沒有留言:
張貼留言