void getDetails(int position) { mCurCheckPosition = position; if (mDualPane) { Log.e("if", String.valueOf(mDualPane)); DescriptionFragment description = (DescriptionFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.details_lay); if (description == null || description.getShownIndex() != position) { Log.e( "ifif", String.valueOf(description == null || description.getShownIndex() != position)); description = DescriptionFragment.newInstance(position); Log.e("descrip", String.valueOf(position)); // FragmentTransaction ft = getFragmentManager().beginTransaction(); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.replace(R.id.details, description); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); description.setImage(newses.get(position).getImageUrl()); description.setTitle(newses.get(position).getTitle()); description.setDiscr(newses.get(position).getDescription()); } } else { Log.e("else", String.valueOf(mDualPane)); Intent intent = new Intent(); intent.setClass(getActivity(), DescriptionActivity.class); intent.putExtra("index", position); intent.putExtra("title", newses.get(position).getTitle()); intent.putExtra("url", newses.get(position).getImageUrl()); intent.putExtra("discrip", newses.get(position).getDescription()); startActivity(intent); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { // If the screen is now in landscape mode, we can show the // dialog in-line so we don't need this activity. finish(); return; } if (savedInstanceState == null) { // During initial setup, plug in the details fragment. DescriptionFragment details = new DescriptionFragment(); details.setArguments(getIntent().getExtras()); getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit(); } }