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:io.github.tonyguyot.acronym.ui.QueryFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ArrayList<Acronym> savedValues = null;
    if (savedInstanceState != null) {
        // the application has been reloaded
        savedValues = savedInstanceState.getParcelableArrayList(KEY_ACRONYMS);
    }/*from   w  ww  .j  a v a  2 s .  co m*/

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_query, container, false);

    // retrieve the different UI items we need to interact with
    mTvQuery = (TextView) view.findViewById(R.id.query_entry);
    mTvResultStatus = (TextView) view.findViewById(R.id.query_result);
    mProgress = (ProgressBar) view.findViewById(R.id.query_progress);

    // init graphical elements
    TextView intro = (TextView) view.findViewById(R.id.query_info);
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Lobster-Regular.ttf");
    intro.setTypeface(tf);

    // initialize the recycler view for the list of results
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.query_list);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(),
            DividerItemDecoration.VERTICAL_LIST);
    recyclerView.addItemDecoration(itemDecoration);
    if (savedValues == null) {
        mAdapter = new QueryAdapter();
    } else {
        mAdapter = new QueryAdapter(savedValues);
    }
    recyclerView.setAdapter(mAdapter);

    // define the callback for the button
    Button submitButton = (Button) view.findViewById(R.id.query_submit);
    submitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onSubmitButtonClick();
        }
    });

    Log.d(TAG, "view has been created");
    return view;
}

From source file:zlyh.dmitry.recaller.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState != null) {
        records = savedInstanceState.getParcelableArrayList(Const.MODEL);
    }/*from ww  w .j av  a 2 s. c o m*/

    setupUI();
    PreferenceUtils.loadCallAndFilterPreferences();
    SqlUtils.loadRecords(records.size());
    ActivityUtils.registerReceivers(this);
    PlayerUtils.startPlayerService();
}

From source file:com.meetingninja.csse.user.UserListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_userlist, container, false);

    dbHelper = new SQLiteUserAdapter(getActivity());

    setUpListView(v);/* w  w  w  .ja  v a  2s  .c o m*/
    Bundle args = getArguments();
    if (args != null && args.containsKey(Keys.Project.MEMBERS)) {
        List<UserParcel> members = args.getParcelableArrayList(Keys.Project.MEMBERS);
        for (UserParcel memberParcel : members) {
            contacts.add(new Contact(memberParcel.getUser(), ""));
        }
        mContactAdapter.notifyDataSetChanged();
        mContactAdapter.getFilter().filter("");

    } else {
        setHasOptionsMenu(true);
        populateList(true); // uses async-task
    }
    return v;
}

From source file:org.proninyaroslav.libretorrent.fragments.DetailTorrentTrackersFragment.java

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        trackers = savedInstanceState.getParcelableArrayList(TAG_TRACKER_LIST);
    }/*w  w  w. j  a v a 2 s. co  m*/
}

From source file:com.example.droidcodin.popularmdb.MovieFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState == null || !savedInstanceState.containsKey("movies")) {
        movieList = new ArrayList<Movie>();

    } else {//w w  w  .j av a2s.c om
        movieList = savedInstanceState.getParcelableArrayList("movie");
    }

    setHasOptionsMenu(true);
}

From source file:org.amahi.anywhere.fragment.NavigationFragment.java

private void setUpServersState(Bundle state) {
    List<Server> servers = state.getParcelableArrayList(State.SERVERS);

    setUpServersContent(servers);//ww  w.j a v  a2s. c o  m

    showContent();
}

From source file:de.skubware.opentraining.activity.create_exercise.ImageFragment.java

/** 
 * Restore the instance state, e.g. after rotation.
 *//*from w  w  w  . j  ava2  s.c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setHasOptionsMenu(true);
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_IMAGELIST_ADAPTER_DATA)) {
        mImageList = savedInstanceState.getParcelableArrayList(KEY_IMAGELIST_ADAPTER_DATA);
    }
}

From source file:com.example.android.popularmovies.app.MoviesFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Restore state if it exists
    if (savedInstanceState == null || !savedInstanceState.containsKey("movies")) {
        movieArray = new ArrayList<Movie>();
    } else {/*  www.j a  v a  2 s  .  co m*/
        movieArray = savedInstanceState.getParcelableArrayList("movies");
    }
    setHasOptionsMenu(true);
}

From source file:com.example.android.popularmovies.fragments.MovieTrailersFragment.java

private void onRestoreState(Bundle savedInstanceState) {
    if (savedInstanceState == null) {
        getLoaderManager().restartLoader(LOADER_ID, null, this);
    } else {//from   w w  w .  j av  a 2s  . c o  m
        if (savedInstanceState.containsKey(TRAILER_ADAPTER_STATE)) {
            ArrayList<Trailer> trailerArrayList = savedInstanceState
                    .getParcelableArrayList(TRAILER_ADAPTER_STATE);
            mTrailerAdapter.setTrailersData(trailerArrayList);
        }
        if (savedInstanceState.containsKey(MOVIE_ACTIVE)) {
            mMovie = savedInstanceState.getParcelable(MOVIE_ACTIVE);
        }
    }
}

From source file:de.gruenewald.udacity.spotifystreamer.TrackFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        mTitle = savedInstanceState.getString(SAVEDINSTANCE_TITLE);
        mNofResults = savedInstanceState.getInt(SAVEDINSTANCE_RESULTS);
        mTrackListPosition = savedInstanceState.getInt(SAVEDINSTANCE_POSITION);
        mTrackListEntries = savedInstanceState.getParcelableArrayList(SAVEDINSTANCE_LIST);
    } else {/*from  w  ww  . j a va  2s  .com*/
        mTrackListPosition = -1;
    }
}