I have fragment activity from which I call say Fragment A then Fragment B from Fragment A and so on. I used backstack properties. So when I click back button from fragment B I goes to fragment A. But from fragment A it does not going to fragment Activity instead it exit from the activity and going to main activity. Any help
My Fragment Activity
public class ShowAllAccounts extends FragmentActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show_all_accounts);
......
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
TableViewFragment mTableViewFragment = new TableViewFragment();
fragmentTransaction.replace(R.id.table_fragment_container, mTableViewFragment,"tabFrag");
fragmentTransaction.commit();
}
}
In my Table view fragment
ViewAccountDetailsFragment AccountViewFragment = new ViewAccountDetailsFragment();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.table_fragment_container, AccountViewFragment, "viewAcctFrag");
fragmentTransaction.addToBackStack(null);
AccountViewFragment.setArguments(dataBundle);
fragmentTransaction.commit();
from here i am calling account view fragment
i am having one more doubt here. From second fragment(only view) i am calling another activity(for edit) and if i want to cancel edit of this activity can i able to go to previous fragment ie. second fragment which was meant to view details.????
please help i am new in android