Java Code Examples for android.os.Bundle#putParcelableArrayList()

The following examples show how to use android.os.Bundle#putParcelableArrayList() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public static BypassedAndOfflineDeviceScrollablePopup newInstance(Version1ButtonColor topButtonColor,
                                                                  String topButtonText, Version1ButtonColor bottomButtonColor, String bottomButtonText,
                                                                  ArrayList<AlertDeviceStateModel> deviceStateModelList,
                                                                  BypassedAndOfflineDeviceScrollablePopup.Callback callback) {
    BypassedAndOfflineDeviceScrollablePopup fragment = new BypassedAndOfflineDeviceScrollablePopup();

    Bundle bundle = new Bundle();
    bundle.putSerializable(TOP_COLOR_KEY, topButtonColor);
    bundle.putSerializable(TOP_TITLE_KEY, topButtonText);
    bundle.putSerializable(BOTTOM_COLOR_KEY, bottomButtonColor);
    bundle.putSerializable(BOTTOM_TITLE_KEY, bottomButtonText);
    bundle.putParcelableArrayList(DEVICES, deviceStateModelList);
    fragment.setArguments(bundle);

    fragment.callback = callback;

    return fragment;
}
 
Example 2
private void route(int position, MyPoiModel poiInfo) {
    AppUtils.closeKeyboard(mEditSearch, this);
    Bundle bundle = new Bundle();
    if ("MainActivity".equals(mFrom) && !(poiInfo.getTypePoi() == TypePoi.BUS_LINE || poiInfo.getTypePoi() == TypePoi.SUBWAY_LINE)) {
        if (null != mResultAdapter) {
            bundle.putParcelableArrayList("poiAll", (ArrayList<MyPoiModel>) mResultAdapter.getList());
        }
        bundle.putInt("position", position);

    } else {
        bundle.putParcelable("poi", poiInfo);
    }

    Intent intent = new Intent();
    intent.putExtras(bundle);
    setResult(MainActivity.REQUEST_SEARCH, intent);
    finish();

}
 
Example 3
Source Project: SuperToasts   File: SuperActivityToast.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Saves the state of all SuperToasts that are showing and/or pending.
 *
 * This should be called in the {@link android.app.Activity#onSaveInstanceState(android.os.Bundle)}
 * method of your Activity.
 * 
 * @param bundle The Bundle provided in onSaveInstanceState()
 */
@SuppressWarnings("unchecked")
public static void onSaveState(Bundle bundle) {
    final ArrayList<Style> styleList = new ArrayList();

    // Create a list of every Style used by a SuperToast in the queue
    for (SuperToast superToast : Toaster.getInstance().getQueue()) {
        if (superToast instanceof SuperActivityToast) {
            superToast.getStyle().isSuperActivityToast = true;
        }
        styleList.add(superToast.getStyle());
    }

    bundle.putParcelableArrayList(BUNDLE_KEY, styleList);

    // Let's avoid any erratic behavior and cancel any showing/pending SuperActivityToasts manually
    Toaster.getInstance().cancelAllSuperToasts();
}
 
Example 4
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList("infoList", infoList);
    if (mPosition != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY, mPosition);
    }
    super.onSaveInstanceState(outState);
}
 
Example 5
Source Project: moviedb-android   File: TVList.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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.
 */
@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("checkLoadMore", checkLoadMore);
        send.putInt("totalPages", totalPages);
        send.putString("currentListURL", getCurrentList());
        send.putString("title", getTitle());
        send.putBoolean("isLoading", isLoading);
        send.putInt("lastVisitedTV", lastVisitedTV);
        if (backState == 1) {
            send.putInt("backState", 1);
            send.putParcelableArrayList("listData", tvList);
            // used to restore the scroll listener variables
            send.putInt("currentPage", endlessScrollListener.getCurrentPage());
            send.putInt("oldCount", endlessScrollListener.getOldCount());
            send.putBoolean("loading", endlessScrollListener.getLoading());
            // Save scroll position
            if (listView != null) {
                Parcelable listState = listView.onSaveInstanceState();
                send.putParcelable("listViewScroll", listState);
            }
        } else
            send.putInt("backState", 0);

        outState.putBundle("save", send);
    }
}
 
Example 6
Source Project: android-samples   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.

    int id = item.getItemId();

    if (id == R.id.nav_insertdata) {
        fragment=new InsertFragment();
    } else if (id == R.id.nav_viewdata) {
        fragment=new DisplayFragment();
        ArrayList<Data> output=(ArrayList)database.readData();
        Bundle bundle=new Bundle();
        bundle.putParcelableArrayList("data",output);
        bundle.putString(" ",output.toString());
        fragment.setArguments(bundle);

    }
    if(fragment!=null)
    {
        FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.content_main,fragment);
        ft.commit();
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
Example 7
public static void show(
    FragmentManager fragmentManager, ArrayList<BarcodeField> barcodeFieldArrayList) {
  BarcodeResultFragment barcodeResultFragment = new BarcodeResultFragment();
  Bundle bundle = new Bundle();
  bundle.putParcelableArrayList(ARG_BARCODE_FIELD_LIST, barcodeFieldArrayList);
  barcodeResultFragment.setArguments(bundle);
  barcodeResultFragment.show(fragmentManager, TAG);
}
 
Example 8
@NonNull
public static AddToPlaylistDialog create(List<Song> songs) {
    AddToPlaylistDialog dialog = new AddToPlaylistDialog();
    Bundle args = new Bundle();
    args.putParcelableArrayList("songs", new ArrayList<>(songs));
    dialog.setArguments(args);
    return dialog;
}
 
Example 9
Source Project: SearchPreference   File: SearchConfiguration.java    License: MIT License 5 votes vote down vote up
private Bundle toBundle() {
    Bundle arguments = new Bundle();
    arguments.putParcelableArrayList(ARGUMENT_INDEX_ITEMS, itemsToIndex);
    arguments.putBoolean(ARGUMENT_HISTORY_ENABLED, historyEnabled);
    arguments.putParcelable(ARGUMENT_REVEAL_ANIMATION_SETTING, revealAnimationSetting);
    arguments.putBoolean(ARGUMENT_FUZZY_ENABLED, fuzzySearchEnabled);
    arguments.putBoolean(ARGUMENT_BREADCRUMBS_ENABLED, breadcrumbsEnabled);
    arguments.putBoolean(ARGUMENT_SEARCH_BAR_ENABLED, searchBarEnabled);
    arguments.putString(ARGUMENT_TEXT_HINT, textHint);
    arguments.putString(ARGUMENT_TEXT_CLEAR_HISTORY, textClearHistory);
    arguments.putString(ARGUMENT_TEXT_NO_RESULTS, textNoResults);
    return arguments;
}
 
Example 10
public static PickCalendarDialogFragment newInstance(ArrayList<Integer> indices,
        ArrayList<String> calendars, ArrayList<ContentValues> valuesList) {
    PickCalendarDialogFragment pcdf = new PickCalendarDialogFragment();
    Bundle args = new Bundle();
    args.putIntegerArrayList("indices", indices);
    args.putStringArrayList("calendars", calendars);
    args.putParcelableArrayList("valuesList", valuesList);
    pcdf.setArguments(args);
    return pcdf;
}
 
Example 11
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    /**
     * Code below to save all the fragment's state
     */

    if (fragment != null) {
        getFragmentManager().putFragment(outState, KEY_ONE, fragment);
    }

    outState.putString(KEY_TWO, mUserUID);
    outState.putString(KEY_THREE, mHeaderKey);

    if (qqOldHeaderKey != null) {
        outState.putString(KEY_MM_ONE, qqOldHeaderKey);
    }

    if (qqUserUid != null) {
        outState.putString(KEY_MM_TWO, qqUserUid);
    }

    if (qqSalesHeaderModel != null) {
        outState.putParcelable(KEY_MM_THREE, qqSalesHeaderModel);
    }

    if (qqSalesDetailModelList != null) {
        outState.putParcelableArrayList(KEY_MM_FOUR, qqSalesDetailModelList);
    }

    if (qqCashPaid != null) {
        outState.putString(KEY_MM_FIVE, qqCashPaid);
    }

    if (qqChangeCash != null) {
        outState.putString(KEY_MM_SIX, qqChangeCash);
    }

}
 
Example 12
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList("matchListA", matchListA);
    outState.putParcelableArrayList("matchListB", matchListB);
    if (mPositionA != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY_A, mPositionA);
    }
    if (mPositionB != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY_B, mPositionB);
    }
    super.onSaveInstanceState(outState);
}
 
Example 13
@NonNull
public static DeletePlaylistDialog create(ArrayList<Playlist> playlists) {
    DeletePlaylistDialog dialog = new DeletePlaylistDialog();
    Bundle args = new Bundle();
    args.putParcelableArrayList("playlists", playlists);
    dialog.setArguments(args);
    return dialog;
}
 
Example 14
@NonNull
public static DeletePlaylistDialog create(ArrayList<Playlist> playlists) {
    DeletePlaylistDialog dialog = new DeletePlaylistDialog();
    Bundle args = new Bundle();
    args.putParcelableArrayList("playlists", playlists);
    dialog.setArguments(args);
    return dialog;
}
 
Example 15
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(TOP_OF_LIST, mLayoutManager.findFirstVisibleItemPosition());
    outState.putParcelableArrayList(STORY_LIST, getViewModel().getStoryList());
}
 
Example 16
Source Project: epoxy   File: MainActivity.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle state) {
  super.onSaveInstanceState(state);
  state.putParcelableArrayList(CAROUSEL_DATA_KEY, (ArrayList<? extends Parcelable>) carousels);
  controller.onSaveInstanceState(state);
}
 
Example 17
@Override
public void saveItems(Bundle state, ArrayList<Parcelable> items) {
    state.putParcelableArrayList(SAVE_KEY, items);
}
 
Example 18
protected void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList(TEMP_WALLPAPER_TILES, mTempWallpaperTiles);
    outState.putInt(SELECTED_INDEX, mSelectedIndex);
}
 
Example 19
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(PreferenceUtil.LIBRARY_CATEGORIES, new ArrayList<>(adapter.getCategoryInfos()));
}
 
Example 20
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(BUNDLE_KEY, mSportsData);
}