Example usage for android.os Bundle getParcelableArrayList

List of usage examples for android.os Bundle getParcelableArrayList

Introduction

In this page you can find the example usage for android.os Bundle getParcelableArrayList.

Prototype

@Nullable
public <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.shizhefei.view.multitype.MultiTypeAdapter.java

/**
 * ???//from w  ww .j  a v a  2  s  .  co  m
 *
 * @param savedInstanceState
 */
public static <DATA extends Parcelable> boolean restoreState(String key, MultiTypeAdapter<DATA> adapter,
        Bundle savedInstanceState) {
    if (savedInstanceState == null) {
        return false;
    }
    List<DATA> list = savedInstanceState.getParcelableArrayList(key);
    if (list != null) {
        adapter.notifyDataChanged(list, true);
        return true;
    }
    return false;
}

From source file:com.amazonaws.devicefarm.android.referenceapp.Fragments.TabFragmentContainer.java

@Override
public void onStart() {
    super.onStart();
    Bundle args = getArguments();
    List<TabViewModel> data = args.getParcelableArrayList(getString(R.string.tab_fragment_bundle_key));
    setUp(data);// w  w w  .  j  a  v a  2s.c om
}

From source file:br.com.maiconribeiro.popularmovies.VideoListFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    this.videos = args.getParcelableArrayList("videos");
    videoListAdapter = new VideoListAdapter(getActivity(), videos);
    setListAdapter(videoListAdapter);// ww w .j a va  2  s. co  m
}

From source file:zack.yovel.clear.controller.foreground.SuggestionsDialogFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle arguments = getArguments();
    suggestions = arguments.getParcelableArrayList(EXTRA_SUGGESTIONS_LIST);
    title = arguments.getString(EXTRA_TITLE);
}

From source file:it.geosolutions.android.map.fragment.FeatureDetailsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {

    super.onViewCreated(view, savedInstanceState);
    // get data from the intent
    // TODO get them from arguments
    Bundle extras = getActivity().getIntent().getExtras();
    // TODO get already loaded data;
    ArrayList<Attribute> arr = extras.getParcelableArrayList("feature");

    adapter = new FeatureInfoAttributesAdapter(getSherlockActivity(), R.layout.feature_info_attribute_row, arr);
    setListAdapter(adapter);// w  w  w.ja v  a  2  s .  c  o m

}

From source file:org.solovyev.android.calculator.errors.FixableErrorsActivity.java

@Override
protected void onCreate(Bundle state) {
    super.onCreate(state);

    if (state != null) {
        errors = state.getParcelableArrayList(STATE_ERRORS);
    } else {/*from  w  w w. ja  va 2s.c  o m*/
        final Intent intent = getIntent();
        errors = intent.getParcelableArrayListExtra(EXTRA_ERRORS);
    }

    if (errors == null) {
        finish();
        return;
    }
    cast(getApplication()).getComponent().inject(this);
    if (state == null) {
        showNextError();
    }
}

From source file:org.mozilla.gecko.tabs.TabHistoryFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Bundle bundle = getArguments();
    historyPageList = bundle.getParcelableArrayList(ARG_LIST);
    toIndex = bundle.getInt(ARG_INDEX);/*from ww  w. j av a 2s  .  c  o  m*/
    final ArrayAdapter<TabHistoryPage> urlAdapter = new TabHistoryAdapter(getActivity(), historyPageList);
    dialogList.setAdapter(urlAdapter);
    dialogList.setOnItemClickListener(this);
}

From source file:org.strongswan.android.ui.fragment.RemediationInstructionsFragment.java

@Override
public void onStart() {
    super.onStart();

    boolean two_pane = getFragmentManager().findFragmentById(R.id.remediation_instruction_fragment) != null;
    if (two_pane) { /* two-pane layout, make list items selectable */
        getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    }/* w w w.java 2  s  .  c  o  m*/

    Bundle args = getArguments();
    if (mInstructions == null && args != null) {
        mInstructions = args.getParcelableArrayList(EXTRA_REMEDIATION_INSTRUCTIONS);
    }
    updateView(mInstructions);

    if (two_pane && mCurrentPosition == -1
            && mInstructions.size() > 0) { /* two-pane layout, select first instruction */
        mCurrentPosition = 0;
        mListener.onRemediationInstructionSelected(mInstructions.get(0));
    }
    getListView().setItemChecked(mCurrentPosition, true);
}

From source file:com.github.johnpersano.supertoasts.library.SuperActivityToast.java

/**
 * Restores the state of all SuperToasts that were showing and/or pending.
 *
 * This should be called in the {@link android.app.Activity#onCreate(android.os.Bundle)}
 * method of your Activity.//  www.java  2 s  .co  m
 *
 * @param context The Activity Context
 * @param bundle The Bundle provided in onCreate()
 */
public static void onRestoreState(Context context, Bundle bundle) {
    // The Bundle will be null sometimes
    if (bundle == null)
        return;

    // Get the List created in onSaveState()
    final ArrayList<Style> styleList = bundle.getParcelableArrayList(BUNDLE_KEY);

    if (styleList == null) {
        Log.e(SuperActivityToast.class.getName(),
                "Cannot recreate " + "SuperActivityToasts onRestoreState(). Was onSaveState() called?");
        return;
    }

    // Create a flag that knows if the SuperActivityToast is first in the List or not
    boolean firstInList = true;
    for (Style style : styleList) {
        if (!style.isSuperActivityToast)
            new SuperToast(context, style).show();
        else {
            // This SuperActivityToast was most likely showing before the orientation change so ignore the show animation
            if (firstInList)
                new SuperActivityToast(context, style).fromOrientationChange().show();
            else
                new SuperActivityToast(context, style).show();
        }
        firstInList = false;
    }
}

From source file:com.alexcoliveira1.lighttalesreader.view.NovelListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.novellist_fragment, container, false);

    Bundle args = getArguments();

    if (args != null) {
        Log.d(TAG, "Args found");
        List<Novel> lNovel = args.getParcelableArrayList("novels");
        if (lNovel != null) {
            Log.d(TAG, "List NOT null = " + lNovel.size());
            novels.clear();//from   w  w  w. j  ava 2  s.  com
            novels.addAll(lNovel);
        }
    }

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_novels);
    mAdapter = new NovelListAdapter(container.getContext(), novels);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(container.getContext()));
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
            DividerItemDecoration.VERTICAL);
    mRecyclerView.addItemDecoration(dividerItemDecoration);

    return view;
}