Fragment setUserVisibleHint - 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 setUserVisibleHint method.

This code example shows how to use the following methods:setRetainInstance, setUserVisibleHint
public class SupportSelectionStateFragment extends Fragment implements SelectionState {
 
  private CommonSelectionStateFragment _common = new CommonSelectionStateFragment();
 
  public SupportSelectionStateFragment() { 
    super(); 
    setRetainInstance(true);
    setUserVisibleHint(false);
  } 
 
  @Override 
  public void onSaveInstanceState(final Bundle state) {
    super.onSaveInstanceState(state);
    _common.onSaveInstanceState(state);
  } 
 
  @Override 
  public void onCreate(final Bundle state) {
    super.onCreate(state);
    _common.onCreate(state);
10
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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);
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setMenuVisibility, setUserVisibleHint
            SurespotLog.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
            mCurTransaction.add(container.getId(), fragment,
                    makeFragmentName(container.getId(), itemId));
        } 
        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();
        } 
     //   SurespotLog.v(TAG, "Detaching item #" + getItemId(position-1) + ": f=" + object 
     //           + " v=" + ((Fragment)object).getView()); 
        mCurTransaction.detach((Fragment)object);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setUserVisibleHint
package com.teamboid.twitter.compat; 
 
import android.annotation.TargetApi; 
import android.app.Fragment; 
import android.os.Build; 
 
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
public class Api15 { 
 
	public static void setUserVisibleHint(Fragment fragment, boolean b) {
		fragment.setUserVisibleHint(b);
	} 
 
} 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setMenuVisibility, setUserVisibleHint
        } else { 
            fragment = getItem(position);
            mCurTransaction.add(container.getId(), fragment, name);
        } 
        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();
        } 
 
        mCurTransaction.detach((Fragment) object);
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setMenuVisibility, setUserVisibleHint
	@Override 
	public void setPrimaryItem(ViewGroup container, int position, Object object) {
		Fragment fragment = (Fragment) object;
		if (fragment != mCurrentPrimaryItem) {
			if (mCurrentPrimaryItem != null) {
				mCurrentPrimaryItem.setMenuVisibility(false);
				mCurrentPrimaryItem.setUserVisibleHint(false);
			} 
			if (fragment != null) {
				fragment.setMenuVisibility(true);
				fragment.setUserVisibleHint(true);
			} 
			mCurrentPrimaryItem = fragment;
		} 
	} 
 
	@Override 
	public void finishUpdate(ViewGroup container) {
		if (mCurTransaction != null) {
			try { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:onSaveInstanceState, setUserVisibleHint
     * http://stackoverflow.com/questions/8748064/starting-activity-from 
     * -fragment-causes-nullpointerexception 
     */ 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        setUserVisibleHint(true);
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 
        // load html from html file from /res/raw 
        InputStream inputStreamText = this.getActivity().getResources().openRawResource(R.raw.help);
 
        mActivity = getActivity();
 
        LinearLayout layout = new LinearLayout(mActivity);
 
        JellyBeanSpanFixTextView text = new JellyBeanSpanFixTextView(mActivity);
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setMenuVisibility, setUserVisibleHint
				Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
			mCurTransaction.attach(fragment);
		} else { 
			fragment = getItem(container, position);
			if (fragment instanceof Laziable) {
				mLazyItems.put(position, fragment);
			} else { 
				mCurTransaction.add(container.getId(), fragment, name);
			} 
		} 
		if (fragment != getCurrentItem()) {
			fragment.setMenuVisibility(false);
			fragment.setUserVisibleHint(false);
		} 
 
		return fragment;
	} 
 
	@Override 
	public void destroyItem(ViewGroup container, int position, Object object) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:onSaveInstanceState, setUserVisibleHint
 
public class SwipeyTabFragment extends Fragment {
     
	@Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        setUserVisibleHint(true);
    } 
     
        public static Fragment newInstance(String title) {
                SwipeyTabFragment f = new SwipeyTabFragment();
                Bundle args = new Bundle();
                args.putString("title", title);
                f.setArguments(args);
                return f;
        } 
 
        @Override 
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                        Bundle savedInstanceState) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setMenuVisibility, setUserVisibleHint
	@Override 
	public void setPrimaryItem(ViewGroup container, int position, Object object) {
		Fragment fragment = (Fragment) object;
		if (fragment != mCurrentPrimaryItem) {
			if (mCurrentPrimaryItem != null) {
				mCurrentPrimaryItem.setMenuVisibility(false);
				mCurrentPrimaryItem.setUserVisibleHint(false);
			} 
			if (fragment != null) {
				fragment.setMenuVisibility(true);
				fragment.setUserVisibleHint(true);
			} 
			mCurrentPrimaryItem = fragment;
		} 
	} 
 
	@Override 
	public void finishUpdate(ViewGroup container) {
		if (mCurTransaction != null) {
			try { 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Fragment setUserVisibleHint Questions & Answers:

setUserVisibleHint Method Overview
Set a hint to the system about whether this fragment's UI is currently visible to the user.
See Code Examples for other Android Fragment Methods: