Please note that most of those examples are outdated and have many mistakes. If you notice on this same example they used findFragmentbyID using R.id.details, yet there are no fragments with that id, it is the FrameLayout that has that id. Also be aware that the API used in this example is deprecated.
with that said, this is what the showDetails method should look like:
void showDetails(int index) {
mCurCheckPosition = index;
if (mDualPane) {
// We can display everything in-place with fragments, so update
// the list to highlight the selected item and show the data.
getListView().setItemChecked(index, true);
// Make new fragment to show this selection.
DetailsFragment details = DetailsFragment.newInstance(index);
// Execute a transaction, replacing any existing fragment
// with this one inside the frame.
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.details, details);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
} else {
// Otherwise we need to launch a new activity to display
// the dialog fragment with selected text.
Intent intent = new Intent();
intent.setClass(getActivity(), DetailsActivity.class);
intent.putExtra("index", index);
startActivity(intent);
}
}
A few extra lines of code could be added so that clicking on an already selected item does nothing rather than recreate and replace the same fragment with the same information.