I am playing around the fragments tutorial found here on section 21. It works fine when my build target is android 4.0
but when i try to change it to make it work with android 2.2
, i get Error inflating class fragment
on the line setContentView(R.layout.main);
on MainActivity
class.
I already added the support package, changed classes ListFragment
and DetailFragment
to extend android.support.v4.app.ListFragment
and android.support.v4.app.Fragment
respectively. There are no compile errors.
Did I miss something? TIA!
--EDIT---
Made it work. I changed DetailActivity.java
and MainActivity.java
to extend FragmentActivity
instead of just Activity
. Everything's okay now. But still don't know why I have to do that.