Java Code Examples for android.app.Fragment#getId()

The following examples show how to use android.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: RxLoaderBackendNestedFragment.java    From rxloader with Apache License 2.0 6 votes vote down vote up
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: FragmentCompatFramework.java    From weex with Apache License 2.0 4 votes vote down vote up
@Override
public int getId(Fragment fragment) {
  return fragment.getId();
}
 
Example 3
Source File: FragmentManagerHelper.java    From JianshuApp with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isAdded(Fragment fragment) {
    // FIXME
    return fragment.isAdded() || fragment.getTag() != null || fragment.getId() != 0;
}
 
Example 4
Source File: FragmentCompatFramework.java    From stetho with MIT License 4 votes vote down vote up
@Override
public int getId(Fragment fragment) {
  return fragment.getId();
}