Code example for Fragment

Methods: getArguments

0
    private ArrayList<Intent> mIntents;
    private IntentListView mListView;
    private int mScrollIndex, mScrollTop;
 
    public int getIcon() { 
        return getArguments().getInt("icon");
    } 
 
    public String getTitle() {
        return getArguments().getString("title");
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        Bundle args = getArguments();
 
        mIntents = args.getParcelableArrayList("intents");
        mListView = new IntentListView(getActivity());
        mListView.setIntents(mIntents);
        if (mScrollIndex != -1 && mScrollTop != -1)
            mListView.setSelectionFromTop(mScrollIndex, mScrollTop);