androidx.fragment.app.FragmentManager.executePendingTransactions()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中androidx.fragment.app.FragmentManager.executePendingTransactions()方法的一些代码示例,展示了FragmentManager.executePendingTransactions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentManager.executePendingTransactions()方法的具体详情如下:
包路径:androidx.fragment.app.FragmentManager
类名称:FragmentManager
方法名:executePendingTransactions

FragmentManager.executePendingTransactions介绍

暂无

代码示例

代码示例来源:origin: ankidroid/Anki-Android

/**
 * Global method to show dialog fragment including adding it to back stack Note: DO NOT call this from an async
 * task! If you need to show a dialog from an async task, use showAsyncDialogFragment()
 *
 * @param newFragment  the DialogFragment you want to show
 */
public void showDialogFragment(DialogFragment newFragment) {
  // DialogFragment.show() will take care of adding the fragment
  // in a transaction. We also want to remove any currently showing
  // dialog, so make our own transaction and take care of that here.
  FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
  Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
  if (prev != null) {
    ft.remove(prev);
  }
  // save transaction to the back stack
  ft.addToBackStack("dialog");
  newFragment.show(ft, "dialog");
  getSupportFragmentManager().executePendingTransactions();
}

代码示例来源:origin: oliexdev/openScale

fragmentManager.executePendingTransactions();

代码示例来源:origin: linkedin/Spyglass

@TargetApi(11)
public static void startFragment(Fragment fragment, FragmentActivity activity, String tag) {
  FragmentManager fragmentManager = activity.getSupportFragmentManager();
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  fragmentTransaction.add(fragment, tag);
  fragmentTransaction.commit();
  fragmentManager.executePendingTransactions();
  activity.invalidateOptionsMenu();
}

相关文章