OK, maybe I'm a little late, but maybe this will help some people do this.
In the class where you are calling the adapter, you need to extend or implement "FragmentActivity". Then your activity will contain a fragment file.
When you call your adapter, call it with a class that extends FragmentActivity
MyAdapterName = new MyAdapterName(MyClassName.this, Objects);
Then in your adapter in getView () - do it.
final Context context = parent.getContext(); FragmentManager fm = ((Activity) context).getFragmentManager();
Be careful to use the good Android browser FragementManager - android.app.FragmentManager is not android.support.v4.app.FragmentManager;
source share