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:zlyh.dmitry.recaller.MainActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (savedInstanceState != null) {
        records = savedInstanceState.getParcelableArrayList(Const.MODEL);
    }/*w  w w . j a v  a  2s .c o  m*/
}

From source file:ar.com.martineo14.spotifystreamer2.ui.fragment.ArtistDetailActivityFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_artist_detail, container, false);
    listView = (ListView) rootView.findViewById(R.id.list_artist_top_ten);
    if (savedInstanceState != null) {
        tracksModelResult = savedInstanceState.getParcelableArrayList(Constants.TRACK_MODEL_RESULT);
        if (tracksModelResult != null) {
            tracksListAdapter = new ArtistTracksListAdapter(getActivity(), tracksModelResult);
            listView.setAdapter(tracksListAdapter);
        }/*from ww w  .  j a va2s  .  co  m*/
    } else {
        Intent intent = getActivity().getIntent();
        if (intent != null && intent.hasExtra(Constants.ARTIST_NAME)) {
            mArtistIDStr = intent.getStringExtra(Constants.ARTIST_ID);
            mArtistNameSrt = intent.getStringExtra(Constants.ARTIST_NAME);
            ArtistTopTenTask artistTopTenTask = new ArtistTopTenTask();
            artistTopTenTask.execute(mArtistIDStr);
        }
        Bundle bundle = getArguments();
        if (bundle != null) {
            mArtistIDStr = bundle.getString(Constants.ARTIST_ID);
            mArtistNameSrt = bundle.getString(Constants.ARTIST_NAME);
            ArtistTopTenTask artistTopTenTask = new ArtistTopTenTask();
            artistTopTenTask.execute(mArtistIDStr);
        }
    }
    return rootView;
}

From source file:com.perm.DoomPlay.SearchVkActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_vk);/*  w  w  w  .j  ava  2 s . com*/

    initializeUi();

    if (savedInstanceState != null) {
        audios = savedInstanceState.getParcelableArrayList("storeAudioSearch");
        if (audios == null)
            audios = new ArrayList<Audio>();
    } else
        audios = new ArrayList<Audio>();

    adapter = new ListsAdapter(audios, this);

    listView.setAdapter(adapter);
    initializeAbstract();
    checkIsShown(savedInstanceState);
}

From source file:net.granoeste.commons.ui.IconContextMenuDialogFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null && mMenuAdapter == null) {
        final ArrayList<IconContextMenuItem> items = savedInstanceState
                .getParcelableArrayList(ICON_CONTEXT_MENU_ITEMS);
        mMenuAdapter = new IconMenuAdapter(getActivity());
        for (final IconContextMenuItem iconContextMenuItem : items) {
            mMenuAdapter.addItem(iconContextMenuItem);
        }/*from w w w .j ava 2 s . c  o m*/
        mTitle = savedInstanceState.getString(ICON_CONTEXT_MENU_TITLE);
    }
}

From source file:fr.cph.chicago.core.fragment.FavoritesFragment.java

@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        final Bundle bundle = activity.getIntent().getExtras();
        busArrivals = bundle.getParcelableArrayList(getString(R.string.bundle_bus_arrivals));
        trainArrivals = bundle.getSparseParcelableArray(getString(R.string.bundle_train_arrivals));
        bikeStations = bundle.getParcelableArrayList(getString(R.string.bundle_bike_stations));
    } else {/* w  w w.  ja  v  a2  s  . com*/
        busArrivals = savedInstanceState.getParcelableArrayList(getString(R.string.bundle_bus_arrivals));
        trainArrivals = savedInstanceState.getSparseParcelableArray(getString(R.string.bundle_train_arrivals));
        bikeStations = savedInstanceState.getParcelableArrayList(getString(R.string.bundle_bike_stations));
        boolean boolTrain = App.checkTrainData(activity);
        if (boolTrain) {
            App.checkBusData(activity);
        }
    }
    if (bikeStations == null) {
        bikeStations = new ArrayList<>();
    }
    Util.trackScreen(getContext(), getString(R.string.analytics_favorites_fragment));
}

From source file:com.github.jobs.ui.fragment.SOUserFetcherReceiver.java

@Override
protected void onFinished(Bundle resultData) {
    super.onFinished(resultData);
    FragmentManager fragmentManager = getFragmentManager();
    Fragment fragment = fragmentManager.findFragmentById(R.id.base_container);
    if (fragment instanceof SOUserPickerFragment) {
        SOUserPickerFragment soUserPickerFragment = (SOUserPickerFragment) fragment;
        ArrayList<SOUser> users = resultData.getParcelableArrayList(StackOverflowUserResolver.RESULT_USERS);
        soUserPickerFragment.updateItems(users);
    } else {/*from   w ww  .  java 2s  . co m*/
        Log.wtf("FragmentReceiver", "The fragment isn't an instance of SOUserFetcherReceiver");
    }
}

From source file:org.fs.todo.presenters.TaskListFragmentPresenterImp.java

@Override
public void restoreState(Bundle restoreState) {
    if (restoreState != null) {
        // this was the reason why we do not have new context in position.
        if (restoreState.containsKey(BUNDLE_ARGS_DATA_SET)) {
            final List<Task> tasks = restoreState.getParcelableArrayList(BUNDLE_ARGS_DATA_SET);
            if (!Collections.isNullOrEmpty(tasks)) {
                dataSet.addAll(tasks);/*w ww . j  a v  a  2 s. c  o m*/
            }
        }
        displayOption = restoreState.getInt(BUNDLE_ARGS_DISPLAY_OPTION, DisplayOptions.ALL);
    }
}

From source file:com.example.android.bitmapfun.ui.SearchStreamGridFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);//w w w.j a v a  2 s.c om

    Bundle b = getArguments();
    streamList = b.getParcelableArrayList(STREAM_LIST);
    searchCriteria = b.getString(SEARCH_CRITERIA);

    mImageThumbSize = getResources().getDimensionPixelSize(R.dimen.image_thumbnail_size);
    mImageThumbSpacing = getResources().getDimensionPixelSize(R.dimen.image_thumbnail_spacing);

    mAdapter = new ImageAdapter(getActivity());

    ImageCacheParams cacheParams = new ImageCacheParams(getActivity(), IMAGE_CACHE_DIR);

    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory

    // The ImageFetcher takes care of loading images into our ImageView children asynchronously
    mImageFetcher = new ImageFetcher(getActivity(), mImageThumbSize);
    mImageFetcher.setLoadingImage(R.drawable.empty_photo);
    mImageFetcher.addImageCache(getActivity().getSupportFragmentManager(), cacheParams);
}

From source file:fr.cph.chicago.fragment.BikeFragment.java

@Override
public final void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        this.mBikeStations = savedInstanceState.getParcelableArrayList("bikeStations");
    } else {/*from   www  . j ava2s  . c om*/
        Bundle bundle = mActivity.getIntent().getExtras();
        this.mBikeStations = bundle.getParcelableArrayList("bikeStations");
    }
    if (this.mBikeStations == null) {
        this.mBikeStations = new ArrayList<BikeStation>();
    }
    setHasOptionsMenu(true);

    Util.trackScreen(mActivity, R.string.analytics_bike_fragment);
}

From source file:com.xbm.android.matisse.ui.MatisseActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode != RESULT_OK)
        return;//from  w  w w. ja v  a2 s.  c o  m

    if (requestCode == REQUEST_CODE_PREVIEW) {
        Bundle resultBundle = data.getBundleExtra(BasePreviewActivity.EXTRA_RESULT_BUNDLE);
        ArrayList<Item> selected = resultBundle.getParcelableArrayList(SelectedItemCollection.STATE_SELECTION);
        int collectionType = resultBundle.getInt(SelectedItemCollection.STATE_COLLECTION_TYPE,
                SelectedItemCollection.COLLECTION_UNDEFINED);
        if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) {
            Intent result = new Intent();
            ArrayList<Uri> selectedUris = new ArrayList<>();
            ArrayList<String> selectedPaths = new ArrayList<>();
            if (selected != null) {
                for (Item item : selected) {
                    selectedUris.add(item.getContentUri());
                    selectedPaths.add(PathUtils.getPath(this, item.getContentUri()));
                }
            }
            result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selectedUris);
            result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPaths);
            setResult(RESULT_OK, result);
            finish();
        } else {
            mSelectedCollection.overwrite(selected, collectionType);
            Fragment mediaSelectionFragment = getSupportFragmentManager()
                    .findFragmentByTag(MediaSelectionFragment.class.getSimpleName());
            if (mediaSelectionFragment instanceof MediaSelectionFragment) {
                ((MediaSelectionFragment) mediaSelectionFragment).refreshMediaGrid();
            }
            updateBottomToolbar();
        }
    } else if (requestCode == REQUEST_CODE_CAPTURE) {
        // Just pass the data back to previous calling Activity.
        Uri contentUri = mMediaStoreCompat.getCurrentPhotoUri();
        String path = mMediaStoreCompat.getCurrentPhotoPath();
        ArrayList<Uri> selected = new ArrayList<>();
        selected.add(contentUri);
        ArrayList<String> selectedPath = new ArrayList<>();
        selectedPath.add(path);
        Intent result = new Intent();
        result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selected);
        result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPath);
        setResult(RESULT_OK, result);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
            MatisseActivity.this.revokeUriPermission(contentUri,
                    Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
        finish();
    }
}