Java tutorial
//package com.java2s; import android.app.Activity; import android.app.Fragment; public class Main { /** * Get a Fragment * @param activity The Activity using the Fragment * @param resId The ID of the Fragment * @return The Fragment */ public static Fragment getFragment(Activity activity, int resId) { return activity.getFragmentManager().findFragmentById(resId); } }