Code example for Fragment

Methods: getArguments, onCreate

0
 
 
    // The argumetn set in the factory will stored in the private variable here. 
    @Override 
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        mCardText = getArguments().getCharSequence(EXTRA_CARD_TEXT);
    } 
 
    @Override 
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        mActivity = (AMActivity) activity;
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater,
            ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.card_layout, container, false);
        cardTextView = (TextView) v.findViewById(R.id.card_text_view);