Fragment getFragmentManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Fragment getFragmentManager method.

This code example shows how to use the following methods: getFragmentManager, onActivityCreated
            return v;
        } 
 
        @Override 
        public void onActivityCreated(Bundle savedInstanceState) {
            super.onActivityCreated(savedInstanceState);
 
            FragmentManager fm = getFragmentManager();
 
            // Check to see if we have retained the worker fragment. 
            mWorkFragment = (RetainedFragment)fm.findFragmentByTag("work");
 
            // If not retained (or first time running), we need to create it. 
            if (mWorkFragment == null) {
                mWorkFragment = new RetainedFragment();
                // Tell it who it is working with. 
                mWorkFragment.setTargetFragment(this, 0);
                fm.beginTransaction().add(mWorkFragment, "work").commit();
            } 
        } 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getArguments, getFragmentManager, isAdded
            // the view hierarchy; it would just never be used. 
            return null; 
        } 
 
        if (getShownIndex() >= mQuickShare.getFeed().size()) {
            if (isAdded()) getFragmentManager().beginTransaction().remove(this).commit();
            return null; 
        } 
 
        Log.d(TAG, "[onCreateView]");
 
        View v = inflater.inflate(R.layout.story_detail_webview, container, false);
 
        Button mShareStory = (Button) v.findViewById(R.id.share_button);
        mShareStory.setOnClickListener(this);
 
        mWebView = (WebView) v.findViewById(R.id.story_webview);
 
        Log.d(TAG, "[onCreateView] url: loading the current story");
 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getActivity, getFragmentManager
    /** 
     * This method is called when login is finished. 
     * See {@link LoginCallback#onLoginCompleted(int, KiiUser, Exception)} 
     */ 
    void onLoginFinished() { 
        FragmentActivity activity = getActivity();
        if (activity == null) { return; }
        // store access token 
        KiiUser user = KiiUser.getCurrentUser();
        String token = user.getAccessToken();
        Pref.setStoredAccessToken(activity, token);
         
        ViewUtil.toNextFragment(getFragmentManager(), BalanceListFragment.newInstance(), false);
    } 
} 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getFragmentManager, getLoaderManager, onCreate
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
//                    makeFragmentName(container.getId(), itemId)); 
            mCurTransaction.add(container.getId(), fragment,
                    getTag(position));
        } 
        if (fragment != mCurrentPrimaryItem) {
            fragment.setMenuVisibility(false);
            fragment.setUserVisibleHint(false);
        } 
 
        return fragment;
    } 
 
    @Override 
    public void destroyItem(ViewGroup container, int position, Object object) {
        if (mCurTransaction == null) {
            mCurTransaction = mFragmentManager.beginTransaction();
        } 
        if (DEBUG) Log.v(TAG, "Detaching item #" + getItemId(position) + ": f=" + object
                + " v=" + ((Fragment) object).getView());
        mCurTransaction.detach((Fragment) object);
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: dismiss, isVisible
 
	@Override 
	protected void onCancelled() { 
		final FragmentManager fm = activity.getFragmentManager();
		final DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG);
		if (fragment != null && fragment.isVisible()) {
			fragment.dismiss();
		} 
		super.onCancelled(); 
	} 
 
	@Override 
	protected void onPostExecute(final File result) {
		final FragmentManager fm = activity.getFragmentManager();
		final DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG);
		if (fragment != null) {
			fragment.dismiss();
		} 
		super.onPostExecute(result);
		if (result != null && result.exists()) {
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getActivity
     * Used by an {@link Fragment} to install itself to the host activity. 
     * 
     * @see FragmentInstallable 
     */ 
    public static void installFragment(Fragment fragment) {
        final Activity a = fragment.getActivity();
        if (a instanceof FragmentInstallable) {
            ((FragmentInstallable) a).onInstallFragment(fragment);
        } 
    } 
 
    /** 
     * Used by an {@link Fragment} to uninstall itself from the host activity. 
     * 
     * @see FragmentInstallable 
     */ 
    public static void uninstallFragment(Fragment fragment) {
        final Activity a = fragment.getActivity();
        if (a instanceof FragmentInstallable) {
            ((FragmentInstallable) a).onUninstallFragment(fragment);
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: startActivityForResult
        } 
 
        if (resultTo == null) {
            startActivity(intent);
        } else { 
            resultTo.startActivityForResult(intent, resultRequestCode);
        } 
    } 
 
    @Override 
    public boolean hasNextButton() { 
        // PreferenceActivity#hasNextButton() is protected, so we need to expose it here. 
        return super.hasNextButton(); 
    } 
 
    @Override 
    public Button getNextButton() {
        // PreferenceActivity#getNextButton() is protected, so we need to expose it here. 
        return super.getNextButton(); 
    } 
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: isDetached
 
            // Check to see if we already have a fragment for this tab, probably 
            // from a previously saved state.  If so, deactivate it, because our 
            // initial state is that a tab isn't shown. 
            mFragment = mActivity.getFragmentManager().findFragmentByTag(mTag);
            if (mFragment != null && !mFragment.isDetached()) {
                FragmentTransaction ft = mActivity.getFragmentManager().beginTransaction();
                ft.detach(mFragment);
                ft.commit();
            } 
        } 
 
        public void onTabSelected(Tab tab, FragmentTransaction ft) {
            if (mFragment == null) {
                mFragment = Fragment.instantiate(mActivity, mClass.getName(), mArgs);
                ft.add(android.R.id.content, mFragment, mTag);
            } else { 
                ft.attach(mFragment);
            } 
        } 
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint

Related Fragment getFragmentManager Questions & Answers:

getFragmentManager Method Overview
Return the FragmentManager for interacting with fragments associated with this fragment's activity.
See Code Examples for other Android Fragment Methods: