Sorry, this question is for those of you who are working on Eclipse with access to ApiDemo code samples .
In particular, I am trying to base a fragment operation on a FragmentLayout sample
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();
I have two questions:
What is the difference between index == 0 and index != 0 ?
The R.id_a_item resource (only appearing in all ApiDemos after searching for it) refers to some menu shortcut resource, which is not entirely clear why it is used here.
The android.developers manual does not explain this bit of code.
ilomambo
source share