Best code examples for Android Fragment class (android.app.Fragment)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Fragment class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Fragment examples from Open Source projects
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
61:	fragment.setMenuVisibility(false); 
62:	fragment.setUserVisibleHint(false); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getActivity
134:	final Activity a = fragment.getActivity(); 
-
136:	((FragmentInstallable) a).onInstallFragment(fragment); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startActivityForResult
84:	resultTo.startActivityForResult(intent, resultRequestCode); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: dismiss, isVisible
66:	if (fragment != null && fragment.isVisible()) { 
67:	fragment.dismiss(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isDetached
91:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
45:	fragment.setMenuVisibility(false); 
46:	fragment.setUserVisibleHint(false); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getId
229:	outState.putInt(KEY_PARENT_FRAGMENT_ID, mParentFragment.getId()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setUserVisibleHint
11:	fragment.setUserVisibleHint(b); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isHidden
123:	if ((f != null) && f.isHidden()) ft.show(f); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
89:	mCurrentPrimaryItem.setMenuVisibility(false); 
90:	mCurrentPrimaryItem.setUserVisibleHint(false); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMenuVisibility
129:	mCurrentPrimaryItem.setMenuVisibility(false); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isDetached
91:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isHidden
57:	if (fragment.isHidden()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: toString
74:	throw new ClassCastException(callbackFragment.toString() 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setArguments
38:	result.setArguments(args); 
-
67:	((BaseActivity<?,?>)getActivity()).getBackStack().startFragmentAt(fragment, null); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: show, isVisible
150:	if (!dialog.isVisible()) { 
151:	dialog.show(getFragmentManager(), "SetReportNoticeDialog"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isDetached
101:	if (mFragment != null && !mFragment.isDetached()) 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getActivity, getMap
51:	_googleMap = _mapFragment.getMap(); 
-
60:	MapsInitializer.initialize(_mapFragment.getActivity()); 
-
92:	_markerManager.setMarkerRelatedListeners(_mapFragment.getActivity(), this); 
-
154:	MapViewUtil.putMyLocationButtonBottomLeft(mapFragment); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isDetached
51:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
89:	mCurrentPrimaryItem.setMenuVisibility(false); 
90:	mCurrentPrimaryItem.setUserVisibleHint(false); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getLoaderManager
40:	LoaderManager lm = m_ctx.getLoaderManager(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isDetached
33:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: show, setArguments
39:	newFragment.setArguments(args); 
40:	newFragment.show(getFragmentManager(), "optionsDialog"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
148:	mCurrentPrimaryItem.setMenuVisibility(false); 
149:	mCurrentPrimaryItem.setUserVisibleHint(false); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: isDetached
64:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
104:	fragment.setMenuVisibility(false); 
105:	fragment.setUserVisibleHint(false); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: show, setTargetFragment
26:	dialog.setTargetFragment(fragment, 0); 
27:	dialog.show(fragment.getFragmentManager(), "dialog"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isDetached
61:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: isDetached
45:	if (fragment != null && !fragment.isDetached()) { 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: isDetached
29:	if (fragment != null && !fragment.isDetached()) { 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setMenuVisibility, setUserVisibleHint
81:	fragment.setMenuVisibility(false); 
82:	fragment.setUserVisibleHint(false); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: show, setTargetFragment
77:	f.setTargetFragment(TaskEditFragment.this, REQ_SET_DATE); 
78:	f.show(getFragmentManager(), "datePicker"); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: isDetached
44:	if (mFragment != null && !mFragment.isDetached()) { 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: show, setArguments
222:	dlg.setArguments(b); 
223:	dlg.show(getFragmentManager(), TAG_PROG_DLG); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: show, setArguments
369:	t.setArguments(args); 
370:	t.show(getFragmentManager(), "timePicker"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setArguments, add
19:	optsFrag.setArguments(getIntent().getBundleExtra("BUNDLE")); 
20:	getFragmentManager().beginTransaction().add(android.R.id.content, optsFrag).commit(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getLoaderManager
78:	this.manager = fragment.getLoaderManager(); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: isAdded
111:	if (fr != null && fr.isAdded()) 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setArguments, add
19:	optsFrag.setArguments(getIntent().getBundleExtra("BUNDLE")); 
20:	getFragmentManager().beginTransaction().add(android.R.id.content, optsFrag).commit(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: show, setArguments
72:	newFragment.setArguments(bdl); 
-
74:	newFragment.show(getFragmentManager(), "datePicker"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: startActivityForResult
44:	fragment.startActivityForResult(intent, code); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setMenuVisibility
160:	mCurrentPrimaryItem.setMenuVisibility(false); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getId
181:	outState.putInt(KEY_PARENT_FRAGMENT_ID, mParentFragment.getId()); 
Full Snippet Info
4
CodeRank
Related Android Fragment Questions & Answers:
Other Android Fragment Examples
7:	import android.view.ViewGroup;
8:	
9:	public class MoviesFragment extends Fragment {
10:	
11:		@Override

Read More

7:	import android.view.ViewGroup;
8:	
9:	public class GamesFragment extends Fragment {
10:	
11:		@Override

Read More

7:	import android.view.ViewGroup;
8:	
9:	public class TopRatedFragment extends Fragment {
10:	
11:		@Override

Read More

See Code Examples for Android Fragment Methods: