Reputation: 6176
this thread says :
FragmentActivity is for use with the backport of fragments found in the support-v4 and support-v13 libraries. The native implementation of fragments was added in API Level 11
I am using a min sdk of level 15 and I was only able to make the import of fragment work with FragmentActivity
and getSupportFragmentManager
, instead of extending Activity
or AppCompatActivity
and using getFragmentManager
:
public class MainActivity extends FragmentActivity implements TaskFragment.OnFragmentInteractionListener {
private TaskFragment mTaskFragment;
private static final String TAG_TASK_FRAGMENT = "task_fragment";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fm = getSupportFragmentManager();
Would someone know why, and have some details about the sdk levels that should be used with v4 or v7, or v13(?)
Thanks
Upvotes: 0
Views: 145
Reputation: 2456
You should extend
you activity from AppCompatActivity
and use getSupportFragmentManager
.
I don't know what TaskFragment
is – something third party I presume.
Remember to add the Google Android support library com.android.support:appcompat
to your project.
Upvotes: 1