當前位置: 首頁>>代碼示例>>Java>>正文


Java Activity.getFragmentManager方法代碼示例

本文整理匯總了Java中android.app.Activity.getFragmentManager方法的典型用法代碼示例。如果您正苦於以下問題:Java Activity.getFragmentManager方法的具體用法?Java Activity.getFragmentManager怎麽用?Java Activity.getFragmentManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.Activity的用法示例。


在下文中一共展示了Activity.getFragmentManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: install

import android.app.Activity; //導入方法依賴的package包/類
/**
 * Installs BackStack into your app. This must be called in {@link Activity#onCreate(Bundle)}
 * @param activity
 */
public static void install(Activity activity){
    //Standard retained fragment code. This creates a new fragment if the fragment couldn't be found
    FragmentManager fm = activity.getFragmentManager();
    RetainedFragment fragment = (RetainedFragment) fm.findFragmentByTag(RetainedFragment.TAG);

    if (fragment == null){
        fragment = new RetainedFragment();
        fm.beginTransaction()
                .add(fragment, RetainedFragment.TAG)
                .commit();
        activity.getApplication().registerActivityLifecycleCallbacks(fragment);
        fragment.set(activity, new BackStackManager(activity));
    }

    backStack = new BackStack(fragment.getBackStackManager(
    ));
}
 
開發者ID:kevinwang5658,項目名稱:backstack,代碼行數:22,代碼來源:BackStack.java

示例2: showEula

import android.app.Activity; //導入方法依賴的package包/類
public static void showEula(Activity activity) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_eula");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    new EulaDialog().show(ft, "dialog_eula");
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:12,代碼來源:AboutUtils.java

示例3: attachTo

import android.app.Activity; //導入方法依賴的package包/類
public static void attachTo(Activity activity, Object executionScope, boolean finishAfterDialog, Bundle argumentsForErrorDialog) {
    android.app.FragmentManager fm = activity.getFragmentManager();
    HoneycombManagerFragment fragment = (HoneycombManagerFragment) fm
            .findFragmentByTag(TAG_ERROR_DIALOG_MANAGER);
    if (fragment == null) {
        fragment = new HoneycombManagerFragment();
        fm.beginTransaction().add(fragment, TAG_ERROR_DIALOG_MANAGER).commit();
        fm.executePendingTransactions();
    }
    fragment.finishAfterDialog = finishAfterDialog;
    fragment.argumentsForErrorDialog = argumentsForErrorDialog;
    fragment.executionScope = executionScope;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:ErrorDialogManager.java

示例4: get

import android.app.Activity; //導入方法依賴的package包/類
public RequestManager get(Activity activity) {
  if (Util.isOnBackgroundThread()) {
    return get(activity.getApplicationContext());
  } else {
    assertNotDestroyed(activity);
    android.app.FragmentManager fm = activity.getFragmentManager();
    return fragmentGet(activity, fm, null /*parentHint*/);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:RequestManagerRetriever.java

示例5: onMessageLoaded

import android.app.Activity; //導入方法依賴的package包/類
@Override
public void onMessageLoaded() {
    Activity currentActivity = CurrentActivityWatchdog.getCurrentActivity();
    FragmentManager fragmentManager = currentActivity.getFragmentManager();
    Fragment fragment = fragmentManager.findFragmentByTag(IamDialog.TAG);
    if (fragment == null) {
        iamDialog.show(fragmentManager, IamDialog.TAG);
    }
}
 
開發者ID:emartech,項目名稱:android-mobile-engage-sdk,代碼行數:10,代碼來源:DefaultMessageLoadedListener.java

示例6: returnFromFragment

import android.app.Activity; //導入方法依賴的package包/類
public static void returnFromFragment(final Fragment fragment){
	final Activity activity=fragment.getActivity();
	if (activity!=null){
		final FragmentManager fragmentManager=activity.getFragmentManager();
		if (fragmentManager!=null) {
			fragmentManager.popBackStack();
		}
	}
}
 
開發者ID:videgro,項目名稱:Ships,代碼行數:10,代碼來源:FragmentUtils.java

示例7: getRxPermissionsFragment

import android.app.Activity; //導入方法依賴的package包/類
private RxPermissionsFragment getRxPermissionsFragment(Activity activity) {
    RxPermissionsFragment rxPermissionsFragment = findRxPermissionsFragment(activity);
    boolean isNewInstance = rxPermissionsFragment == null;
    if (isNewInstance) {
        rxPermissionsFragment = new RxPermissionsFragment();
        FragmentManager fragmentManager = activity.getFragmentManager();
        fragmentManager
                .beginTransaction()
                .add(rxPermissionsFragment, TAG)
                .commitAllowingStateLoss();
        fragmentManager.executePendingTransactions();
    }
    return rxPermissionsFragment;
}
 
開發者ID:ChangWeiBa,項目名稱:AesExoPlayer,代碼行數:15,代碼來源:RxPermissions.java

示例8: handleObserveLifecycle

import android.app.Activity; //導入方法依賴的package包/類
private void handleObserveLifecycle(Activity activity, LifecycleListener lifecycleListener) {
	Log.d(TAG, "this context type  is Activity");
	assertNotDestroyed(activity);
	android.app.FragmentManager fm = activity.getFragmentManager();
	LifecycleListenerFragment fragment = getSupportRequestManagerFragment(fm);
	FragmentLifecycle activityFragmentLifecycle = getActivityFragmentLifecycle(fragment);
	activityFragmentLifecycle.addListener(lifecycleListener);
}
 
開發者ID:myjoybar,項目名稱:Android-lifecycle-listener,代碼行數:9,代碼來源:LifecycleManager.java

示例9: with

import android.app.Activity; //導入方法依賴的package包/類
public CarouselRequestManager with(Activity activity) {
    FragmentManager fm = activity.getFragmentManager();
    CarouselFragment carouselFragment = new CarouselFragment();
    carouselFragment.setCarouselLifecycleListener(carouselLifecycleListener);
    fm.beginTransaction().add(carouselFragment, CAROUSEL_FRAGMENT_TAG).commitAllowingStateLoss();
    return new CarouselRequestManager(this);
}
 
開發者ID:shucc,項目名稱:Carousel,代碼行數:8,代碼來源:CarouselView.java

示例10: attachTo

import android.app.Activity; //導入方法依賴的package包/類
public static void attachTo(Activity activity, Object executionScope, boolean finishAfterDialog, Bundle argumentsForErrorDialog) {
    FragmentManager fm = activity.getFragmentManager();
    HoneycombManagerFragment fragment = (HoneycombManagerFragment) fm.findFragmentByTag(ErrorDialogManager.TAG_ERROR_DIALOG_MANAGER);
    if (fragment == null) {
        fragment = new HoneycombManagerFragment();
        fm.beginTransaction().add(fragment, ErrorDialogManager.TAG_ERROR_DIALOG_MANAGER).commit();
        fm.executePendingTransactions();
    }
    fragment.finishAfterDialog = finishAfterDialog;
    fragment.argumentsForErrorDialog = argumentsForErrorDialog;
    fragment.executionScope = executionScope;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:ErrorDialogManager.java

示例11: getFragmentManagerHelper

import android.app.Activity; //導入方法依賴的package包/類
/**
 * Creates a new helper to work with either the FragmentManager or the legacy support
 * FragmentManager transparently. Returns null if we're not attached to an Activity.
 *
 * DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE
 * MEMORY LEAKS.
 */
private @Nullable FragmentManagerHelper getFragmentManagerHelper() {
  Activity activity = getCurrentActivity();
  if (activity == null) {
    return null;
  }
  if (activity instanceof FragmentActivity) {
    return new FragmentManagerHelper(((FragmentActivity) activity).getSupportFragmentManager());
  } else {
    return new FragmentManagerHelper(activity.getFragmentManager());
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:19,代碼來源:DialogModule.java

示例12: getRxActivityResultsFragment

import android.app.Activity; //導入方法依賴的package包/類
private RxActivityResultsFragment getRxActivityResultsFragment(Activity activity) {
    RxActivityResultsFragment fragment = findRxActivityResultsFragment(activity);
    if (fragment == null) {
        fragment = new RxActivityResultsFragment();
        FragmentManager fragmentManager = activity.getFragmentManager();
        fragmentManager.beginTransaction()
                .add(fragment, TAG)
                .commitAllowingStateLoss();
        fragmentManager.executePendingTransactions();
    }
    return fragment;
}
 
開發者ID:mohamad-amin,項目名稱:RxActivityResults,代碼行數:13,代碼來源:RxActivityResults.java

示例13: showWiFiDialog

import android.app.Activity; //導入方法依賴的package包/類
public static void showWiFiDialog(Activity activity) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_wifi");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    WiFiDialog.newInstance(isWiFiEnabled(activity)).show(ft, "dialog_wifi");
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:11,代碼來源:WiFiUtils.java

示例14: setup

import android.app.Activity; //導入方法依賴的package包/類
@Override public void setup(Activity activity) {
    this.fragmentManager = new WeakReference<>(activity.getFragmentManager());
}
 
開發者ID:rostdev,項目名稱:lepka,代碼行數:4,代碼來源:BackStackDefault.java

示例15: setup

import android.app.Activity; //導入方法依賴的package包/類
@Override public void setup(Activity activity) {

        this.activity = new WeakReference<>(activity);
        this.fragmentManager = new WeakReference<>(activity.getFragmentManager());
    }
 
開發者ID:rostdev,項目名稱:lepka,代碼行數:6,代碼來源:ExecutorDefault.java


注:本文中的android.app.Activity.getFragmentManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。