I have the following activity which launches a fragment when the tab is selected:
public class MainActivity extends Activity implements TabListener {
Fragment f = null;
.....
public void onTabSelected(Tab tab, FragmentTransaction ft) {
.....
if (tab.getPosition() == 0) {
if (initalSync == true) {
progress1.setVisibility(TRIM_MEMORY_UI_HIDDEN);
}
f = new EventFragment();
Bundle data = new Bundle();
data.putInt("idx", tab.getPosition());
f.setArguments(data);
}
if (tab.getPosition() == 1) {
progress1.setVisibility(TRIM_MEMORY_UI_HIDDEN);
f = new MapsFragment();
Bundle data = new Bundle();
data.putInt("idx", tab.getPosition());
f.setArguments(data);
}
.....
ft.replace(android.R.id.content, f);
}
When ever I press the phones back button on any of the fragments it closes my app. I know this is related to the backstack but every method I have tried fails.
any ideas?