Android examples for User Interface:Fragment
remove Fragment By Tag
//package com.java2s; import android.app.Fragment; import android.app.FragmentTransaction; import android.content.Context; import android.app.Activity; public class Main { public static Boolean removeFragmentByTag(Context context, String tag) { return removeFragmentByTag(context, tag, 0); }//from w ww .j a va2s .c o m public static Boolean removeFragmentByTag(Context context, String tag, int exitTansaction) { Fragment fragment = ((Activity) context).getFragmentManager() .findFragmentByTag(tag); if (fragment != null) { FragmentTransaction ft = ((Activity) context) .getFragmentManager().beginTransaction(); ft.setCustomAnimations(0, exitTansaction); ft.remove(fragment); ft.commit(); return true; } return false; } }