Skip to content

Instantly share code, notes, and snippets.

@basilbeltran
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basilbeltran/935b1559bbfc67571765 to your computer and use it in GitHub Desktop.
Save basilbeltran/935b1559bbfc67571765 to your computer and use it in GitHub Desktop.
FragmentActivity called with intent
public class MActivity extends MFragmentActivity {
//simple case
protected Fragment createFragment(){ return new MFragment();} // no need for MFragment to have newInstance()
// -or- if your fragment needs data (see MListFragment for the explicit Intent call)
// call the Activity with Intent; pass along extra (UUID in this template) for arg to MFragment
protected Fragment createFragment() {
UUID data = (UUID)getIntent().getSerializableExtra(MFragment.EXTRA_M_ID);
return MFragment.newInstance(id);}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment