I have one Fragment:
ProductsFragments extends Fragment
and one Activity
AdminMenuActivity extends ActionBarActivity
I want to call ProductsFragments from AdminMenuActivity. I have used 2 options:
1)
FragmentManager fm = getSupportFragmentManager();
for(int i = 0; i < fm.getBackStackEntryCount(); ++i) {
fm.popBackStack();
}
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
tx.replace(R.id.frame_layout, android.support.v4.app.Fragment.instantiate(AdminMenuActivity.this, fragments[1]));
tx.commit();
2)
Intent intent1 = new Intent(AdminMenuActivity.this, ProductsActivity.class);
startActivity(intent1);
Both are failed. I don't want to extend ProductsFragments with FragmentActivity because it doesn't give me supportedActionBar v7
So how do I call Fragment
?