I'm extending SherlockFragmentActivity
. When I inspect the element this.getFragmentManager()
I obtain the following description.
FragmentManager android.app.Activity.getFragmentManager()
public FragmentManager getFragmentManager ()
Added in API level 11
Return the FragmentManager for interacting with fragments associated with this activity.
This means that I can use it only for API level 11 or more.
In fact the following code give me an error:
android.app.FragmentManager fragmentManager = this.getFragmentManager();
android.app.FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
DetailsServiceListFragment fragment = new DetailsServiceListFragment();
fragmentTransaction.add(R.id.dettservizio,fragment);
where DetailsServiceListFragment
extends SherlockListFragment
The error is on the fourth line, and says:
The method add(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, DetailsServiceListFragment)
This happens because DetailsServiceListFragment need to extend Fragment. But why I can't extend SherlockListFragment
?
When I use the classes included in Sherlok project what Fragment I have to use?