Example usage for android.os Bundle putParcelable

List of usage examples for android.os Bundle putParcelable

Introduction

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

Prototype

public void putParcelable(@Nullable String key, @Nullable Parcelable value) 

Source Link

Document

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

Usage

From source file:com.DGSD.DGUtils.ImageDownloader.ImageLoader.java

public void notifyImageLoaded(String url, Bitmap bitmap) {
    Message message = new Message();
    message.what = HANDLER_MESSAGE_ID;//from  ww  w  . j  a  v a  2s .  c o  m
    Bundle data = new Bundle();
    data.putString(IMAGE_URL_EXTRA, url);
    Bitmap image = bitmap;
    data.putParcelable(BITMAP_EXTRA, image);
    message.setData(data);

    handler.sendMessage(message);
}

From source file:net.reichholf.dreamdroid.fragment.MovieListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelable("movie", mMovie);

    String[] selectedTags;/*from   ww w .  j a  v  a2 s.  c  om*/
    if (mSelectedTags != null) {
        selectedTags = new String[mSelectedTags.size()];
        mSelectedTags.toArray(selectedTags);
    } else {
        selectedTags = new String[0];
    }
    outState.putStringArray("selectedTags", selectedTags);

    String[] oldTags;
    if (mOldTags != null) {
        oldTags = new String[mOldTags.size()];
        mOldTags.toArray(oldTags);
    } else {
        oldTags = new String[0];
    }
    outState.putStringArray("oldTags", oldTags);
    outState.putString("currentLocation", mCurrentLocation);
    outState.putInt("selectedLocationPosition", mSelectedLocationPosition);

    super.onSaveInstanceState(outState);
}

From source file:com.bilibili.boxing.utils.CameraPickerHelper.java

public void onSaveInstanceState(Bundle out) {
    SavedState state = new SavedState();
    state.mOutputFile = mOutputFile;/*from w  w  w  .ja va  2  s  .  c  om*/
    state.mSourceFilePath = mSourceFilePath;
    out.putParcelable(STATE_SAVED_KEY, state);
}

From source file:com.wglxy.example.dashL.SearchActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    // TODO get company ID/details
    Bundle args = new Bundle();
    args.putParcelable(Constants.KEY_COMPANY_BUNDLE_ARGS, data.get(position));
    Intent companyIntent = new Intent(SearchActivity.this, CompanyActivity.class);
    companyIntent.putExtras(args);// w  w  w . jav  a  2  s .c  om
    startActivity(companyIntent);
}

From source file:cn.com.hgh.view.SlideSwitch.java

@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putBoolean("isOpen", this.isOpen);
    return bundle;
}

From source file:com.hyrt.cnp.account.AccountAuthenticator.java

@Override
public Bundle getAuthToken(final AccountAuthenticatorResponse response, final Account account,
        final String authTokenType, final Bundle options) throws NetworkErrorException {
    Log.d(TAG, "Retrieving OAuth2 token");

    final Bundle bundle = new Bundle();

    if (!ACCOUNT_TYPE.equals(authTokenType))
        return bundle;

    AccountManager am = AccountManager.get(context);
    String password = am.getPassword(account);
    if (TextUtils.isEmpty(password)) {
        bundle.putParcelable(KEY_INTENT, createLoginIntent(response));
        return bundle;
    }// w  w  w .  j  a  v  a2  s.  c om
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("username", account.name);
    params.set("password", password);
    User.UserModel userModel = null;
    try {
        userModel = getCustomRestTemplate().postForObject("http://api.chinaxueqian.com/account/login", params,
                User.UserModel.class);
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (userModel == null || userModel.getData() == null || TextUtils.isEmpty(userModel.getData().getToken()))
        bundle.putParcelable(KEY_INTENT, createLoginIntent(response));
    else {
        bundle.putString(KEY_ACCOUNT_NAME, account.name);
        bundle.putString(KEY_ACCOUNT_TYPE, ACCOUNT_TYPE);
        bundle.putString(KEY_AUTHTOKEN, userModel.getData().getToken() + "&uuid="
                + userModel.getData().getUuid() + "&sid=" + userModel.getData().getNursery_id());
        am.clearPassword(account);
    }
    return bundle;
}

From source file:com.android.contacts.common.list.PhoneNumberPickerFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable(KEY_FILTER, mFilter);
    outState.putString(KEY_SHORTCUT_ACTION, mShortcutAction);
}

From source file:com.armannds.eldgos.katla.popularmovies.ui.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (CollectionUtils.isNotEmpty(mMoviesAdapter.getMovies())) {
        ArrayList<Movie> movies = new ArrayList<>(mMoviesAdapter.getMovies());
        outState.putParcelable(mMoviesKey, Parcels.wrap(movies));
    }//from  w  w w.  j  av a  2  s . c om
    outState.putString(mTitleKey, getTitle().toString());
}

From source file:com.whamads.nativecamera.NativeCameraLauncher.java

@Override
public Bundle onSaveInstanceState() {

    Bundle state = new Bundle();
    state.putInt("mQuality", mQuality);
    state.putInt("targetWidth", targetWidth);
    state.putInt("targetHeight", targetHeight);
    state.putString("date", date);
    state.putParcelable("imageUri", imageUri);
    state.putSerializable("photo", photo);

    return state;
}

From source file:com.airflo.FlightListActivity.java

/**
 * Method needed to restore scroll position
 *//*from  ww w  .j  a v  a  2  s  .co m*/
@Override
protected void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
    savedListState = ((FlightListFragment) getSupportFragmentManager().findFragmentById(R.id.flight_list))
            .getListView().onSaveInstanceState();
    state.putParcelable(LIST_STATE, savedListState);
}