本文整理了Java中android.app.FragmentManager.saveFragmentInstanceState()
方法的一些代码示例,展示了FragmentManager.saveFragmentInstanceState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentManager.saveFragmentInstanceState()
方法的具体详情如下:
包路径:android.app.FragmentManager
类名称:FragmentManager
方法名:saveFragmentInstanceState
暂无
代码示例来源:origin: AppIntro/AppIntro
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment) object;
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
while (mSavedState.size() <= position) {
mSavedState.add(null);
}
mSavedState.set(position, fragment.isAdded()
? mFragmentManager.saveFragmentInstanceState(fragment) : null);
mFragments.set(position, null);
mCurTransaction.remove(fragment);
}
代码示例来源:origin: materialos/android-icon-pack
@SuppressLint("CommitTransaction")
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment) object;
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object
+ " v=" + ((Fragment) object).getView());
while (mSavedState.size() <= position) {
mSavedState.add(null);
}
mSavedState.set(position, mFragmentManager.saveFragmentInstanceState(fragment));
mFragments.set(position, null);
mCurTransaction.remove(fragment);
}
代码示例来源:origin: com.albedinsky.android/pager-adapters
/**
*/
@Override
@SuppressLint("CommitTransaction")
public void destroyItem(ViewGroup container, int position, Object object) {
if (mPendingTransaction == null) {
// Will be committed in call to finishUpdate(...).
this.mPendingTransaction = mFragmentManager.beginTransaction();
}
final Fragment fragment = (Fragment) object;
if (PagerAdaptersConfig.DEBUG_LOG_ENABLED) {
Log.v(TAG, "Removing item(id: " + getItemId(position) + ", fragment: " + fragment + ", view: " + fragment.getView() + ").");
}
while (mSavedState.size() <= position) {
this.mSavedState.add(null);
}
this.mSavedState.set(
position,
fragment.isAdded() ? mFragmentManager.saveFragmentInstanceState(fragment) : null
);
this.mFragments.set(position, null);
this.mPendingTransaction.remove(fragment);
}
代码示例来源:origin: com.albedinsky.android/pager-adapters-core
/**
*/
@Override
@SuppressLint("CommitTransaction")
public void destroyItem(ViewGroup container, int position, Object object) {
if (mPendingTransaction == null) {
// Will be committed in call to finishUpdate(...).
this.mPendingTransaction = mFragmentManager.beginTransaction();
}
final Fragment fragment = (Fragment) object;
if (PagerAdaptersConfig.DEBUG_LOG_ENABLED) {
Log.v(TAG, "Removing item(id: " + getItemId(position) + ", fragment: " + fragment + ", view: " + fragment.getView() + ").");
}
while (mSavedState.size() <= position) {
this.mSavedState.add(null);
}
this.mSavedState.set(
position,
fragment.isAdded() ? mFragmentManager.saveFragmentInstanceState(fragment) : null
);
this.mFragments.set(position, null);
this.mPendingTransaction.remove(fragment);
}
内容来源于网络,如有侵权,请联系作者删除!