I\'m learning Android development. I get stuck at something that should be very easy.
Im creating an App with one Activity, 2 fragments and 1 interface.
OP was so close to having a solution that would have worked fine for API 11 and newer without needing support.v4.
He just needed to change his Fragment to also not use support.v4, in its import statement.
Summary of the two approaches. ALL your Activities and Fragments should have code that looks like exactly one of these; do not mix them! (Not all lines are needed in all files; use lines as needed.)
support-v4 approach
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.Fragment; <-- ".support.v4"
import android.support.v4.app.FragmentManager;
... MainActivity extends FragmentActivity ...
... = getSupportFragmentManager();
.... YourFragment extends Fragment ... <-- same in both approaches
API 11+ approach
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
... MainActivity extends Activity ...
... = getFragmentManager();
.... YourFragment extends Fragment ... <-- same in both approaches
So if you have a project that is written using one approach above, and you are integrating in code from elsewhere, be sure to look for these lines, and change them to match what you have.