public static FragmentType forEnumName(String name) { try { return FragmentType.valueOf(name); } catch (Exception e) { return null; } }
public static FragmentType getFragmentFor(Class<? extends BaseFragment> clazz) { for (FragmentType fragmentType : FragmentType.values()) { if (fragmentType.fragmentClass.isAssignableFrom(clazz)) { return fragmentType; } } return null; }
@SuppressWarnings("unchecked") public static FragmentType getFragmentFor(String name) { try { Class<? extends BaseFragment> fragmentType = (Class<? extends BaseFragment>) Class.forName(name); return FragmentType.getFragmentFor(fragmentType); } catch (ClassNotFoundException e) { return null; } }