Skip to content

Instantly share code, notes, and snippets.

@viktor1190
Last active November 9, 2016 13:47
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 viktor1190/ff31932205c9c35fd34c8b7fd5ede7d3 to your computer and use it in GitHub Desktop.
Save viktor1190/ff31932205c9c35fd34c8b7fd5ede7d3 to your computer and use it in GitHub Desktop.
public class MyAndroidFragment {
// =============================================================================================
// CONSTANTS
// =============================================================================================
public final String LOG_TAG = getClass().getSimpleName();
private static final int WINDOW_TITLE = R.string.windows_label_mi_clase;
private static final String BUNDLE_KEY_SOME_INT = "bk_some_int";
// =============================================================================================
// ATTRIBUTES
// =============================================================================================
// =============================================================================================
// CONSTRUCTOR
// =============================================================================================
/**
* Puts the fragment arguments into a bundle
*/
public static void createArguments(Bundle bundle, int someInt) {
bundle.putInt(BUNDLE_KEY_SOME_INT, someInt);
}
/**
* Create new fragment instance with all the required arguments
*/
public static MyAndroidFragment newInstance(int someInt) {
MyAndroidFragment myFragment = new MyAndroidFragment();
Bundle args = createArguments(someInt);
myFragment.setArguments(args);
return myFragment;
}
/**
* Launch a new activity
*/
public static void launch(int id) {
Intent intent = new Intent(context, MyActivity.class);
intent.putExtra(ARG_ID, id);
context.startActivity(intent);
}
/**
* initialization routine
*/
public void init() {
}
// =============================================================================================
// GETTERS & SETTERS
// =============================================================================================
// =============================================================================================
// COMPONENT LIFE CYCLE
// =============================================================================================
// =============================================================================================
// INHERITANCE @OVERRIDE
// =============================================================================================
// =============================================================================================
// EVENTS (EVENT BUS)
// =============================================================================================
// =============================================================================================
// METHODS
// =============================================================================================
// =============================================================================================
// PRIVATE METHODS
// =============================================================================================
// =============================================================================================
// INNER CLASS
// =============================================================================================
// public class MyInnerClass {
//----------------------------------------------------------
// INNER CONSTANTS
//----------------------------------------------------------
//----------------------------------------------------------
// INNER ATTRIBUTES
//----------------------------------------------------------
//----------------------------------------------------------
// INNER CONSTRUCTOR
//----------------------------------------------------------
//----------------------------------------------------------
// INNER GETTERS & SETTERS
//----------------------------------------------------------
//----------------------------------------------------------
// INNER CLASS INHERITANCE @OVERRIDE
//----------------------------------------------------------
//----------------------------------------------------------
// INNER METHODS
//----------------------------------------------------------
//----------------------------------------------------------
// INNER PRIVATE METHODS
//----------------------------------------------------------
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment