/** 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); }
public static TempFragment newInstance(int viewId) { TempFragment tempFragment = new TempFragment(); tempFragment.viewId = viewId; return tempFragment; }