Skip to content Skip to sidebar Skip to footer

Android: Adding A Simple Fragment

I am pretty new to Android Apps, so I hope I can find some help here. I have already searched for my problem in here and found something, but that does not work. I want to add a Fr

Solution 1:

You're mixing up classes from the support library and the new classes available only to newer versions of the OS.

For example, you import android.app.FragmentTransaction (available for API 11+) but the call to getSupportFragmentManager().beginTransaction() returns android.support.v4.app.FragmentTransaction ...

You need to import android.support.v4.app.FragmentTransaction and make sure that your HomeFragment extends android.support.v4.app.Fragment and not android.app.Fragment.


Post a Comment for "Android: Adding A Simple Fragment"