Code example for Bundle

Methods: putString

0
public class EditorFragment extends SherlockFragment { 
  private static final String KEY_HINT="hint";
 
  static EditorFragment newInstance(String hint) {
    EditorFragment frag=new EditorFragment();
    Bundle args=new Bundle();
 
    args.putString(KEY_HINT, hint);
    frag.setArguments(args);
 
    return(frag);
  } 
 
  @Override 
  public View onCreateView(LayoutInflater inflater,
                           ViewGroup container,
                           Bundle savedInstanceState) {
    View result=inflater.inflate(R.layout.editor, container, false);
    EditText editor=(EditText)result.findViewById(R.id.editor);
 
    editor.setHint(getArguments().getString(KEY_HINT));