コード例 #1
0
  /** Activity result will be lost when the activity has been recreated. To be fixed. */
  public static void startActivityForResult(
      final FragmentActivity fragmentActivity, Intent intent, View view) {
    FragmentManager fm = fragmentActivity.getSupportFragmentManager();
    Fragment tempFragment = TempFragment.newInstance(view.getId());
    fm.beginTransaction().add(tempFragment, tempFragment.toString()).commit();
    fm.executePendingTransactions();

    tempFragment.startActivityForResult(intent, REQUEST_CODE);
  }
コード例 #2
0
 public static TempFragment newInstance(int viewId) {
   TempFragment tempFragment = new TempFragment();
   tempFragment.viewId = viewId;
   return tempFragment;
 }