Code example for Fragment

Methods: getArguments, onCreate

0
        /** 
         * During creation, if arguments have been supplied to the fragment 
         * then parse those out. 
         */ 
        @Override public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
 
            Bundle args = getArguments();
            if (args != null) {
                CharSequence label = args.getCharSequence("label");
                if (label != null) {
                    mLabel = label;
                } 
            } 
        } 
 
        /** 
         * Create the view for this fragment, using the arguments given to it. 
         */ 
        @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {