Example usage for android.os Bundle putParcelableArrayList

List of usage examples for android.os Bundle putParcelableArrayList

Introduction

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

Prototype

public void putParcelableArrayList(@Nullable String key, @Nullable ArrayList<? extends Parcelable> value) 

Source Link

Document

Inserts a List of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:de.sourcestream.movieDB.controller.GenresList.java

/**
 * Called to ask the fragment to save its current dynamic state,
 * so it can later be reconstructed in a new instance of its process is restarted.
 *
 * @param outState Bundle in which to place your saved state.
 */// w w w.  j  a v  a 2s  .  co m
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // Used to avoid bug where we add item in the back stack
    // and if we change orientation twice the item from the back stack has null values
    if (save != null)
        outState.putBundle("save", save);
    else {
        Bundle send = new Bundle();
        send.putInt("backState", backState);
        if (backState == 1) {
            send.putParcelableArrayList("listData", genresList);
            // used to restore the scroll listener variables
            // Save scroll position
            if (listView != null) {
                Parcelable listState = listView.onSaveInstanceState();
                send.putParcelable("listViewScroll", listState);
            }

        }
        outState.putBundle("save", send);

    }
}

From source file:org.videolan.vlc.gui.PlaylistActivity.java

protected boolean handleContextItemSelected(MenuItem item, final int position) {
    int id = item.getItemId();

    final MediaWrapper media = (MediaWrapper) mAdapter.getItem(position);

    if (id == R.id.audio_list_browser_set_song) {
        AudioUtil.setRingtone(media, this);
        return true;
    } else if (id == R.id.audio_list_browser_append) {
        mService.append(media);/*ww w  .  j ava2  s  . co m*/
        return true;
    } else if (id == R.id.audio_list_browser_delete) {
        mAdapter.remove(position);
        UiTools.snackerWithCancel(getWindow().getDecorView(), getString(R.string.file_deleted), new Runnable() {
            @Override
            public void run() {
                deleteMedia(media);
            }
        }, new Runnable() {
            @Override
            public void run() {
                mAdapter.addItem(position, media);
            }
        });
        return true;
    } else if (id == R.id.audio_view_info) {
        showInfoDialog(media);
        return true;
    } else if (id == R.id.audio_view_add_playlist) {
        ArrayList<MediaWrapper> medias = new ArrayList<>();
        medias.add(media);
        FragmentManager fm = getSupportFragmentManager();
        SavePlaylistDialog savePlaylistDialog = new SavePlaylistDialog();
        Bundle args = new Bundle();
        args.putParcelableArrayList(SavePlaylistDialog.KEY_NEW_TRACKS, medias);
        savePlaylistDialog.setArguments(args);
        savePlaylistDialog.show(fm, "fragment_add_to_playlist");
        return true;
    }
    return false;
}

From source file:ufms.br.com.ufmsapp.fragment.EventosFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(STATE_EVENTOS, eventos);
}

From source file:com.dmitrymalkovich.android.popularmoviesapp.MovieListActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    ArrayList<Movie> movies = mAdapter.getMovies();
    if (movies != null && !movies.isEmpty()) {
        outState.putParcelableArrayList(EXTRA_MOVIES, movies);
    }/* ww w  .j a va 2s .com*/
    outState.putString(EXTRA_SORT_BY, mSortBy);

    // Needed to avoid confusion, when we back from detail screen (i. e. top rated selected but
    // favorite movies are shown and onCreate was not called in this case).
    if (!mSortBy.equals(FetchMoviesTask.FAVORITES)) {
        getSupportLoaderManager().destroyLoader(FAVORITE_MOVIES_LOADER);
    }
}

From source file:com.ultramegasoft.flavordex2.fragment.AbsPhotosFragment.java

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(STATE_PHOTOS, mPhotos);
    outState.putParcelable(STATE_CAPTURE_URI, mCapturedPhoto);
    if (mPhotoLoader != null) {
        outState.putParcelable(STATE_LOADING_URI, mPhotoLoader.getUri());
    }/*  www .ja v a 2  s.  c o m*/
}

From source file:com.ayuget.redface.ui.fragment.TopicFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putParcelableArrayList(ARG_TOPIC_POSITIONS_STACK, topicPositionsStack);
}

From source file:com.google.samples.apps.friendlyping.fragment.FriendlyPingFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mPingerAdapter == null) {
        return;/*from   www  .  j a va  2s.  com*/
    }
    ArrayList<Pinger> tmpItems = mPingerAdapter.getItems();
    if (tmpItems != null) {
        outState.putParcelableArrayList(KEY_PINGERS, tmpItems);
    }
}

From source file:com.abhijitvalluri.android.fitnotifications.AppChoicesActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putParcelableArrayList(STATE_APP_SELECTIONS, mAppSelections);
    savedInstanceState.putBoolean(STATE_SETUP_COMPLETE, mSetupComplete);
    Parcelable listState = mRecyclerView.getLayoutManager().onSaveInstanceState();
    savedInstanceState.putParcelable(STATE_RECYCLER_VIEW, listState);

    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.bitants.wally.fragments.LatestFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (imagesAdapter != null) {
        outState.putParcelableArrayList(STATE_IMAGES, imagesAdapter.getImages());
        outState.putInt(STATE_CURRENT_PAGE, currentPage);
    }/*from   w  ww.  j a v  a 2s .c om*/
    super.onSaveInstanceState(outState);
}

From source file:com.todoroo.astrid.tags.TagsControlSet.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putParcelableArrayList(EXTRA_SELECTED_TAGS, selectedTags);
    outState.putStringArrayList(EXTRA_NEW_TAGS, getNewTags());
}