Android examples for User Interface:Fragment
is Current Fragment
//package com.java2s; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import java.util.List; public class Main { public static boolean isCurrentFragment( FragmentManager fragmentManager, Class<? extends Fragment> clazz) { Fragment fragment = null;/* www. j a v a 2 s . c om*/ List<Fragment> fragments = fragmentManager.getFragments(); int index = fragments.size(); while (fragment == null && index >= 0) { index--; fragment = fragments.get(index); } return fragment != null && fragment.getClass().equals(clazz); } }