Last active
August 29, 2015 14:26
-
-
Save basilbeltran/935b1559bbfc67571765 to your computer and use it in GitHub Desktop.
FragmentActivity called with intent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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