Code example for Fragment

Methods: setArguments

0
         */ 
        static MyFragment newInstance(CharSequence label) {
            MyFragment f = new MyFragment();
            Bundle b = new Bundle();
            b.putCharSequence("label", label);
            f.setArguments(b);
            return f;
        } 
 
        /** 
         * Parse attributes during inflation from a view hierarchy into the 
         * arguments we handle. 
         */ 
        @Override public void onInflate(Activity activity, AttributeSet attrs,
                Bundle savedInstanceState) {
            super.onInflate(activity, attrs, savedInstanceState);
 
            TypedArray a = activity.obtainStyledAttributes(attrs,
                    R.styleable.FragmentArguments); 
            mLabel = a.getText(R.styleable.FragmentArguments_android_label);
            a.recycle();