Java Code Examples for android.support.v4.app.fragment#getId()
The following examples show how to use
android.support.v4.app.fragment#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxLoaderBackendNestedFragmentCompat.java From rxloader with Apache License 2.0 | 6 votes |
private String getStateId() { if (stateId != null) { return stateId; } Fragment parentFragment = getParentFragment(); stateId = parentFragment.getTag(); if (stateId == null) { int id = parentFragment.getId(); if (id > 0) { stateId = Integer.toString(id); } } if (stateId == null) { throw new IllegalStateException("Fragment dose not have a valid id"); } return stateId; }
Example 2
Source File: MainActivity.java From identity-samples with Apache License 2.0 | 5 votes |
public void setFragment(boolean isVerifying) { Fragment current = getCurrentFragment(); Fragment frag = statusFrag; if (isVerifying) { frag = validationFrag; } if (current == null || frag.getId() != current.getId()) { FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(container.getId(), frag); transaction.commitAllowingStateLoss(); } }
Example 3
Source File: ArrayPagerAdapter.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override public Object instantiateItem(ViewGroup container, int position) { if (currTransaction == null) { currTransaction = fm.beginTransaction(); } Fragment fragment = getExistingFragment(position); if (fragment != null) { if (fragment.getId() == container.getId()) { retentionStrategy.attach(fragment, currTransaction); } else { fm.beginTransaction().remove(fragment).commit(); fm.executePendingTransactions(); currTransaction.add(container.getId(), fragment, getFragmentTag(position)); } } else { fragment = createFragment(entries.get(position).getDescriptor()); currTransaction.add(container.getId(), fragment, getFragmentTag(position)); } if (fragment != currPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
Example 4
Source File: MainActivity.java From android-credentials with Apache License 2.0 | 5 votes |
public void setFragment(boolean isVerifying) { Fragment current = getCurrentFragment(); Fragment frag = statusFrag; if (isVerifying) { frag = validationFrag; } if (current == null || frag.getId() != current.getId()) { FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(container.getId(), frag); transaction.commitAllowingStateLoss(); } }
Example 5
Source File: FragmentIdHelper.java From android-task with Apache License 2.0 | 5 votes |
public static String getFragmentId(Fragment fragment) { String index = getIndex(fragment); int id = fragment.getId(); String tag = fragment.getTag(); if (tag == null) { tag = "null"; } return index + '/' + id + '/' + tag; }
Example 6
Source File: ArrayPagerAdapter.java From cwac-pager with Apache License 2.0 | 5 votes |
@Override public Object instantiateItem(ViewGroup container, int position) { if (currTransaction == null) { currTransaction=fm.beginTransaction(); } Fragment fragment=getExistingFragment(position); if (fragment != null) { if (fragment.getId() == container.getId()) { retentionStrategy.attach(fragment, currTransaction); } else { fm.beginTransaction().remove(fragment).commit(); fm.executePendingTransactions(); currTransaction.add(container.getId(), fragment, getFragmentTag(position)); } } else { fragment=createFragment(entries.get(position).getDescriptor()); currTransaction.add(container.getId(), fragment, getFragmentTag(position)); } if (fragment != currPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
Example 7
Source File: DlQueueActivity.java From aMuleRemote with GNU General Public License v3.0 | 4 votes |
@Override public void onAttachFragment(Fragment fragment) { super.onAttachFragment(fragment); if (fragment.getId() == R.id.fragment_dlqueue) mDlQueueFragment = (DlQueueFragment) fragment; }
Example 8
Source File: FragmentCompatSupportLib.java From weex with Apache License 2.0 | 4 votes |
@Override public int getId(Fragment fragment) { return fragment.getId(); }
Example 9
Source File: FragmentCompatSupportLib.java From stetho with MIT License | 4 votes |
@Override public int getId(Fragment fragment) { return fragment.getId(); }