android - 我怎样才能保存 fragment ?当我旋转屏幕时

标签 android android-fragments

<分区>

Possible Duplicate:
ViewPager and fragments — what's the right way to store fragment's state?

如何保存 fragment ? (它位于 Activity 中)当我旋转屏幕时, Activity 被重新启动, fragment 被重新创建enter image description here

最佳答案

尝试在 fragment 的 onCreate 中使用 setRetainInstance(true);

关于android - 我怎样才能保存 fragment ?当我旋转屏幕时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12263503/

相关文章:

android - 我想在android中的不同日期(星期一,星期二等)的特定时间安排任务

android - 意外的android系统调用使滚动图形卡顿的流畅显示

android - 包裹 android.os.Parcel : Unmarshalling unknown type code

Android SDK 管理器在选择存储库时出现 "Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml"错误

java - 没有输入流数据到达事件?

Android - JobScheduler 或 BroadcastReceiver?

android - Android 中 map fragment 上显示的黑线

java - AdView 未出现在应用底部

java - 在 Android 应用程序中找不到 NullPointerException 的原因

android - Fragments 与弃用的 TabActivity 在 3.0 之前的设备上