I am sorry, this question is for those of you working on Eclipse with access to the ApiDemo sample codes.
Specifically, I am trying to base a fragment activity on the sample called FragmentLayout
The following code is problematic for me (you can find the full code in ApiDemo FragmentLayout.java, ShowDetails() method):
// Execute a transaction, replacing any existing fragment
// with this one inside the frame.
FragmentTransaction ft = getFragmentManager().beginTransaction();
if (index == 0) {
ft.replace(R.id.details, details);
} else {
ft.replace(R.id.a_item, details);
}
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
Two questions I have:
What's the difference between
index == 0
andindex != 0
?The resource R.id_a_item (only occurence in all ApiDemos, after searching it) belongs to some kind of menu shortcut resource, not clear at all why it is used here.
The android.developers guide does not explain this bit of code.