Can someone explain in the Fragments example
here: http://developer.android.com/guide/components/fragments.html inside
the TitlesFragment's showDetails() method why ft.replace() references
R.id.a_item if index != 0? Here is the block of code or you can check out
the link:
// 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); // <--- Where is R.id.a_item
}
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
I can't find this R.id.a_item anywhere in the sample layouts except as a
menu item
(inside
android-sdk-linux/extras/android/support/samples/Support4Demos/res/menu/shortcuts.xml).
But this is not used with the Fragment Layout example. The only way I
could get this example to work was to comment out the if-else completely
and just do ft.replace(R.id.details, details). It seems to work exactly
like the App/Fragment/Layout example inside the Emulator. I'm just
wondering what I'm missing here... Is this a bug?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en