Java tutorial
//package com.java2s; import android.app.Fragment; import android.app.FragmentManager; public class Main { public static boolean isFragmentInLayout(FragmentManager fragmentManager, int fragmentId) { return getFragmentInLayout(fragmentManager, fragmentId) != null; } public static Fragment getFragmentInLayout(FragmentManager fragmentManager, int fragmentId) { return fragmentManager.findFragmentById(fragmentId); } }