当前位置: 首页>>代码示例>>Java>>正文


Java FragmentManager.findFragmentByTag方法代码示例

本文整理汇总了Java中android.app.FragmentManager.findFragmentByTag方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentManager.findFragmentByTag方法的具体用法?Java FragmentManager.findFragmentByTag怎么用?Java FragmentManager.findFragmentByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.FragmentManager的用法示例。


在下文中一共展示了FragmentManager.findFragmentByTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.v(TAG, "onCreate: ");

    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

    FragmentManager fragmentManager = getFragmentManager();
    settingsFragment = (SettingsFragment) fragmentManager.findFragmentByTag(TAG);

    if (settingsFragment == null) {
        settingsFragment = SettingsFragment.newInstance(R.xml.settings_main);

        replaceFragment(settingsFragment);
    } else {
        showFragment(settingsFragment);
    }
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:19,代码来源:SettingsActivity.java

示例2: setupTransaction

import android.app.FragmentManager; //导入方法依赖的package包/类
/**
 * Setup a base dialog fragment transaction. Handles the removing of a
 * previous fragment if it exists and adds itself to the backstack.
 *
 * @return FragmentTransaction
 */
private FragmentTransaction setupTransaction(Activity activity) {
    FragmentManager manager = activity.getFragmentManager();
    FragmentTransaction ft = manager.beginTransaction();
    Fragment prev = manager.findFragmentByTag("dialog");

    if (prev != null)
        ft.remove(prev);

    ft.addToBackStack(null);

    return ft;
}
 
开发者ID:linklux,项目名称:android-schedules,代码行数:19,代码来源:BaseDialogFragment.java

示例3: showChangeLogDialog

import android.app.FragmentManager; //导入方法依赖的package包/类
public static void showChangeLogDialog(FragmentManager fragmentManager) {
    ChangelogDialog changelogDialog = new ChangelogDialog();
    FragmentTransaction ft = fragmentManager.beginTransaction();
    Fragment prev = fragmentManager.findFragmentByTag("changelogdemo_dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    changelogDialog.show(ft, "changelogdemo_dialog");
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:11,代码来源:ChangelogDialog.java

示例4: onSaveInstanceState

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle state) {
    if (records.list().isEmpty()) {
        state.putBoolean(STATE_CONTENT_VIEW, getErrorView().getVisibility() == View.VISIBLE);
    } else {
        state.putBoolean(STATE_CONTENT_VIEW, true);
        state.putParcelable(Podcast.class.getName(), podcast);

        FragmentManager fragmentManager = getFragmentManager();
        RecordsDataFragment dataFragment = (RecordsDataFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
        if (dataFragment == null) {
            dataFragment = new RecordsDataFragment();
            fragmentManager.beginTransaction().add(dataFragment, FRAGMENT_TAG).commit();
        }
        dataFragment.setRecords(records);
        dataFragment.setPaginator(paginator);
        state.putInt(STATE_FOOTER, adapter.getFooterMode().ordinal());
    }
    super.onSaveInstanceState(state);
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:21,代码来源:RecordsActivity.java

示例5: install

import android.app.FragmentManager; //导入方法依赖的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

示例6: startRecording

import android.app.FragmentManager; //导入方法依赖的package包/类
private void startRecording() {
    FragmentManager fragmentManager = getFragmentManager();
    ListenerFragment listenerFragment = (ListenerFragment)
            fragmentManager.findFragmentByTag(TAG_LISTENER_FRAGMENT);

    if (listenerFragment == null) {
        listenerFragment = new ListenerFragment();
        fragmentManager
                .beginTransaction()
                .add(listenerFragment, TAG_LISTENER_FRAGMENT)
                .commit();
    }
}
 
开发者ID:gstraube,项目名称:cythara,代码行数:14,代码来源:MainActivity.java

示例7: onMessageLoaded

import android.app.FragmentManager; //导入方法依赖的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

示例8: cancelDialog

import android.app.FragmentManager; //导入方法依赖的package包/类
private static void cancelDialog(FragmentManager fragmentManager, String tag) {
    Fragment fragment = fragmentManager.findFragmentByTag(tag);

    if (fragment == null) return;
    DialogFragment dialogFragment = (DialogFragment) fragment;

    if (dialogFragment.getDialog() == null) return;
    dialogFragment.getDialog().cancel();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:10,代码来源:ConfirmSyncDataStateMachine.java

示例9: onCreate

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final String TAG = "ClientCertificateFragment";

    FragmentManager fm = getFragmentManager();
    ClientCertificateFragment fragment = (ClientCertificateFragment) fm.findFragmentByTag(TAG);

    if (fragment == null) {
        fragment = new ClientCertificateFragment();
        fm.beginTransaction().replace(android.R.id.content, fragment, TAG).commit();
    }
}
 
开发者ID:rootkiwi,项目名称:an2linuxclient,代码行数:15,代码来源:ClientCertificateActivity.java

示例10: onCreate

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String TAG = "EnabledApplicationsPreferenceFragment";
    FragmentManager fm = getFragmentManager();
    EnabledApplicationsPreferenceFragment fragment = (EnabledApplicationsPreferenceFragment) fm.findFragmentByTag(TAG);
    if (fragment == null) {
        fragment = new EnabledApplicationsPreferenceFragment();
        fm.beginTransaction().replace(android.R.id.content, fragment, TAG).commit();
    }
}
 
开发者ID:rootkiwi,项目名称:an2linuxclient,代码行数:12,代码来源:EnabledApplicationsActivity.java

示例11: onCreate

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String TAG = "CustomNotificationSettingsFragment";
    FragmentManager fm = getFragmentManager();
    CustomNotificationSettingsFragment fragment = (CustomNotificationSettingsFragment) fm.findFragmentByTag(TAG);
    if (fragment == null) {
        fragment = new CustomNotificationSettingsFragment();
        fm.beginTransaction().replace(android.R.id.content, fragment, TAG).commit();
    }
}
 
开发者ID:rootkiwi,项目名称:an2linuxclient,代码行数:12,代码来源:CustomNotificationSettingsActivity.java

示例12: onDestroy

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onDestroy() {
  super.onDestroy();

  // FragmentTransaction is not allowed if Activity is destroyed
  if (!willDestroyActivity() && (!willRecreate())) {
    //noinspection ConstantConditions
    FragmentManager fm = getActivity().getFragmentManager();
    Fragment fragment = fm.findFragmentByTag(getFragmentTag());

    if (fragment != null) {
      fm.beginTransaction().remove(fragment).commit();
    }
  }
}
 
开发者ID:seven332,项目名称:Stage,代码行数:16,代码来源:FragmentScene.java

示例13: onBackPressed

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    if (isSearchViewExpanded()) {
        hideSearchView();
    } else {
        final FragmentManager fm = getFragmentManager();
        mBackStackEntryPopped = fm.popBackStackImmediate();
        final int entryCnt = fm.getBackStackEntryCount();

        if (entryCnt > 0) {
            final FragmentManager.BackStackEntry entry = fm.getBackStackEntryAt(entryCnt - 1);
            final Fragment fragment = fm.findFragmentByTag(entry.getName());

            if (fragment instanceof CurrentFeedFragment) {
                mBottomNavigationView.setSelectedItemId(R.id.action_view_current_feed);
            } else if (fragment instanceof FeedSubscriptionsFragment) {
                mBottomNavigationView.setSelectedItemId(R.id.action_view_feed_subscriptions);
            } else if (fragment instanceof SavedEntriesFragment) {
                mBottomNavigationView.setSelectedItemId(R.id.action_view_saved_entries);
            } else {
                mBackStackEntryPopped = fm.popBackStackImmediate();
                mBottomNavigationView.setSelectedItemId(R.id.action_view_feed_subscriptions);
            }

            mBackStackEntryPopped = false;
        } else {
            super.onBackPressed();
        }
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:31,代码来源:MainActivity.java

示例14: attachTo

import android.app.FragmentManager; //导入方法依赖的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

示例15: findOrNull

import android.app.FragmentManager; //导入方法依赖的package包/类
public static <T> RetainFragment<T> findOrNull(FragmentManager fm, String tag) {
    // noinspection unchecked, we know this is the the right type
    return (RetainFragment<T>) fm.findFragmentByTag(tag);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:5,代码来源:RetainFragment.java


注:本文中的android.app.FragmentManager.findFragmentByTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。