Code example for Fragment

Methods: getArgumentsonCreate

0
    super.onAttach(activity);
    callback = (Callback) activity;
  } 
 
  @Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    menuEntry = args.getString(ARG_MENU_ENTRY);
    contentLevel = args.getInt(ARG_CONTENT_LEVEL);
 
    setHasOptionsMenu(true);
  } 
 
  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.content, container, false);
 
    ((TextView) v.findViewById(R.id.menuEntry)).setText(menuEntry);
    ((TextView) v.findViewById(R.id.contentLevel)).setText("We're at level " + contentLevel);
    v.findViewById(R.id.goDeeper).setOnClickListener(new View.OnClickListener() {
Stop searching for code, let great code find you!  Add Codota to your java IDE