当前位置: 首页>>代码示例>>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;未经允许,请勿转载。