List of usage examples for android.support.v4.app FragmentManager findFragmentByTag
public abstract Fragment findFragmentByTag(String tag);
From source file:android.support.asy.image.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager./*from ww w. j ava2 s . co m*/ * * @param fm * The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ public static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add // it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; }
From source file:cmu.cconfs.instantMessage.util.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager./*ww w. ja v a 2s.c o m*/ * * @param fm * The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // BEGIN_INCLUDE(find_create_retain_fragment) // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add // it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; // END_INCLUDE(find_create_retain_fragment) }
From source file:com.example.android.networkconnect.NetworkFragment.java
/** * Static initializer for NetworkFragment that sets the URL of the host it will be downloading * from.// www . jav a2 s . c o m */ public static NetworkFragment getInstance(FragmentManager fragmentManager, String url) { // Recover NetworkFragment in case we are re-creating the Activity due to a config change. // This is necessary because NetworkFragment might have a task that began running before // the config change and has not finished yet. // The NetworkFragment is recoverable via this method because it calls // setRetainInstance(true) upon creation. NetworkFragment networkFragment = (NetworkFragment) fragmentManager.findFragmentByTag(NetworkFragment.TAG); if (networkFragment == null) { networkFragment = new NetworkFragment(); Bundle args = new Bundle(); args.putString(URL_KEY, url); networkFragment.setArguments(args); fragmentManager.beginTransaction().add(networkFragment, TAG).commit(); } return networkFragment; }
From source file:com.example.reminder.alarm.AlarmUtils.java
public static void showTimeEditDialog(FragmentManager manager, final Alarm alarm, TimePickerDialog.OnTimeSetListener listener, boolean is24HourMode) { int hour, minutes; if (alarm == null) { hour = 0;/*from ww w .java 2 s . co m*/ minutes = 0; } else { hour = alarm.hour; minutes = alarm.minutes; } Log.d("AlarmUtils", "" + hour + ":" + minutes); TimePickerFragment df = new TimePickerFragment(hour, minutes, listener); // Make sure the dialog isn't already added. manager.executePendingTransactions(); final FragmentTransaction ft = manager.beginTransaction(); final Fragment prev = manager.findFragmentByTag(FRAG_TAG_TIME_PICKER); if (prev != null) { ft.remove(prev); } ft.commit(); df.show(manager, "timePicker"); }
From source file:com.android.simpleimageloader.image.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and add it using FragmentManager. * /*from w w w.ja va 2 s . co m*/ * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // BEGIN_INCLUDE(find_create_retain_fragment) // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; // END_INCLUDE(find_create_retain_fragment) }
From source file:android.bitmap.util.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager./*from w w w .j a v a2s . c o m*/ * * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; }
From source file:com.common.app.image.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager.//from w ww . j a va 2 s.co m * * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; }
From source file:cn.com.wo.bitmap.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager.//from www . ja v a2 s . c o m * * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(ImageFetcher.TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, ImageFetcher.TAG).commitAllowingStateLoss(); } return mRetainFragment; }
From source file:com.example.mohmurtu.registration.imagesUtil.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager.//from w w w. jav a 2 s . c o m * * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { //BEGIN_INCLUDE(find_create_retain_fragment) // Check to see if we have retained the worker pp__fragment_camera_cwac. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; //END_INCLUDE(find_create_retain_fragment) }
From source file:angel.zhuoxiu.picker.utils.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager.//from w ww . j a v a 2s .co m * * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { //BEGIN_INCLUDE(find_create_retain_fragment) // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; //END_INCLUDE(find_create_retain_fragment) }