Skip to content

Instantly share code, notes, and snippets.

@KowalczykBartek
Last active December 27, 2015 21:29
Show Gist options
  • Save KowalczykBartek/7391654 to your computer and use it in GitHub Desktop.
Save KowalczykBartek/7391654 to your computer and use it in GitHub Desktop.
/*
ze względu na to ze chce dla różnych orientacji inaczej wypełnić fragmenty,
muszę sprawdzić w jakiej aktualnie orientacji się znajduje.
*/
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
PersonFragment articleFrag = (PersonFragment)
getSupportFragmentManager().findFragmentById(R.id.detail_container);
articleFrag.updateArticleView(person);
//Ląduje tutaj w przypadku kiedy aktualną orientacją jest landscape.
}else{
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
args.putSerializable("context", person);
newFragment.setArguments(args);
transaction.replace(R.id.fragment_container, newFragment);
ransaction.addToBackStack(null);
transaction.commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment