Replacing fragments and orientation change

前端 未结 3 1569
余生分开走
余生分开走 2020-12-25 14:20

I\'m developing an Android application targeting 2.x and 3.0 devices and thus I\'m using the compatibilty API. I\'m testing on Android 2.0.

I\'m trying to replace a

3条回答
  •  长发绾君心
    2020-12-25 14:49

    Don't create the SearchFormFragment in XML. Instead have an empty FrameLayout which you populate in Activity.onCreate() without adding it to the back stack. This way the Activity will keep the current Fragment instead of trying to add the one specified in XML.

    Also, using AsyncLoader may be a better approach, see http://code.google.com/p/android/issues/detail?id=14944

提交回复
热议问题