public static ProgressFragment newInstance() { ProgressFragment frag = new ProgressFragment(); frag.setRetainInstance(true); Bundle args = new Bundle(); frag.setArguments(args); return frag; }
public void execute(FragmentActivity activity, String title, String message) { // Create progress fragment progressFragment = new ProgressFragment(); Bundle args = new Bundle(); args.putString("title", title); args.putString("message", message); progressFragment.setArguments(args); activity .getSupportFragmentManager() .beginTransaction() .add(progressFragment, ProgressFragment.DEFAULT_TAG) .commit(); // Start async task ProgressAsyncTask asyncTask = new ProgressAsyncTask(); asyncTask.execute(); }