Java Code Examples for android.os.Bundle.putDouble()

The following are Jave code examples for showing how to use putDouble() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Unofficial-Ups   File:   View Source Code Vote up 6 votes
public static void eventCalculate(Context context,Course course, double grade){
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_CALCULATION)
            .putCustomAttribute("Course name", course.getName())
            .putCustomAttribute("Course code", course.getCode())
            .putCustomAttribute("Result", grade));

    Bundle params = new Bundle();

    try {
        Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_CALCULATION, new JSONObject()
                .put("Course name",course.getName())
                .put("Course code",course.getCode())
    } catch (JSONException e) {

Example 2
Project: SeafoodBerserker   File:   View Source Code Vote up 6 votes
public void freeze(Bundle bundle) {

        bundle.putParcelable("mBitmap", mBitmap);
        bundle.putDouble("mX", mX);
        bundle.putDouble("mXv", mXv);
        bundle.putDouble("mY", mY);
        bundle.putDouble("mYv", mYv);
        bundle.putDouble("mSpinv", mSpinv);
        bundle.putDouble("mSpin", mSpin);
        bundle.putBoolean("mBoom", mBoom);
        bundle.putString("mText", mText);
        bundle.putBoolean("fade", fade);

        bundle.putInt("mPaintColor", mPaint.getColor());
        bundle.putInt("mPaintAlpha", mPaint.getAlpha());
        bundle.putDouble("mScale", mScale);
        bundle.putBoolean("mHit", mHit);
        bundle.putDouble("mValue", mValue);

Example 3
Project: Protestr   File:   View Source Code Vote up 6 votes
protected void onSaveInstanceState(Bundle outState) {
    //This MUST be done before saving any of your own or your base class's variables
    final Bundle mapViewSaveState = new Bundle(outState);
    if (mapView != null)
    outState.putBundle(MAP_VIEW_SAVED_STATE, mapViewSaveState);

    outState.putParcelable(EVENT_BITMAP_SAVED_STATE, eventBitmapIntent);
    outState.putParcelableArrayList(ADDED_USERS_SAVED_STATE, addedUsers);
    outState.putInt(YEAR_SAVED_STATE, year);
    outState.putInt(MONTH_SAVED_SAVED_STATE, month);
    outState.putInt(DAY_OF_MONTH_SAVED_STATE, dayOfMonth);
    outState.putInt(HOUR_SAVED_STATE, hour);
    outState.putInt(MINUTES_SAVED_STATE, minutes);
    outState.putDouble(EVENT_LATITUDE_SAVED_STATE, latitude);
    outState.putDouble(EVENT_LONGITUDE_SAVED_STATE, longitude);
    outState.putString(EVENT_ISO3_CODE_SAVED_STATE, iso3);
Example 4
Project: ALCAssessment   File:   View Source Code Vote up 5 votes
public static ConversionDialog getInstance(Card card, boolean addSwapButton){
    Bundle args = new Bundle();
    args.putDouble(DOUBLE_TAG, card.getCurrentRate());
    args.putString(FROM_TAG, card.getFrom());
    args.putString(TO_TAG, card.getTo());
    args.putBoolean(SWAP, addSwapButton);

    ConversionDialog dialog = new ConversionDialog();
    return dialog;
Example 5
Project: MyFlightbookAndroid   File:   View Source Code Vote up 5 votes
private void returnValue(double d) {
    Bundle bundle = new Bundle();
    bundle.putDouble(COMPUTED_TIME, d);

    Intent mIntent = new Intent();
    setResult(RESULT_OK, mIntent);
Example 6
Project: Sega   File:   View Source Code Vote up 5 votes
private void loadProfileDetailsOf(String userId) {
    ProfileDetailFragment fragment = new ProfileDetailFragment();
    Bundle args = new Bundle();
    args.putInt("theme", color);
    //        args.putString(ViMarket.product_ID, productId);
    args.putString(ViMarket.currency_ID, cur);
    args.putDouble(ViMarket.currency_RATE, rate);
    getSupportFragmentManager().beginTransaction().replace(, fragment).commit();
Example 7
Project: Sega   File:   View Source Code Vote up 5 votes
private void loadproductDetailsOf(String productId, String userId) {
    ProductDetailFragment fragment = new ProductDetailFragment();
    Bundle args = new Bundle();

    args.putString(ViMarket.product_ID, productId);
    args.putString(ViMarket.user_ID, userId);
    args.putDouble(ViMarket.currency_RATE, session.getCurrency());
    getFragmentManager().beginTransaction().replace(, fragment).commit();
Example 8
Project: DDComponentForAndroid   File:   View Source Code Vote up 5 votes
 * @param typeDef type
 * @param key     key
 * @param value   value
public static void setBundleValue(Bundle bundle, Integer typeDef, String key, String value) {
    if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) {

    try {
        if (null != typeDef) {
            if (typeDef == Type.BOOLEAN.ordinal()) {
                bundle.putBoolean(key, Boolean.parseBoolean(value));
            } else if (typeDef == Type.BYTE.ordinal()) {
                bundle.putByte(key, Byte.valueOf(value));
            } else if (typeDef == Type.SHORT.ordinal()) {
                bundle.putShort(key, Short.valueOf(value));
            } else if (typeDef == Type.INT.ordinal()) {
                bundle.putInt(key, Integer.valueOf(value));
            } else if (typeDef == Type.LONG.ordinal()) {
                bundle.putLong(key, Long.valueOf(value));
            } else if (typeDef == Type.FLOAT.ordinal()) {
                bundle.putFloat(key, Float.valueOf(value));
            } else if (typeDef == Type.DOUBLE.ordinal()) {
                bundle.putDouble(key, Double.valueOf(value));
            } else if (typeDef == Type.STRING.ordinal()) {
                bundle.putString(key, value);
            } else if (typeDef == Type.PARCELABLE.ordinal()) {
            } else if (typeDef == Type.OBJECT.ordinal()) {
                bundle.putString(key, value);
            } else {
                bundle.putString(key, value);
        } else {
            bundle.putString(key, value);
    } catch (Throwable ex) {
Example 9
Project: OpenHomeAnalysis   File:   View Source Code Vote up 5 votes
public void onSaveInstanceState(Bundle outState) {
    outState.putLong(PARAM_FROM_DATE, this.fromDate);
    outState.putLong(PARAM_TO_DATE, this.toDate);
    outState.putDouble(PARAM_KWH_COST, this.kwhCost);
Example 10
Project: RNLearn_Project1   File:   View Source Code Vote up 5 votes
 * Convert a {@link WritableMap} to a {@link Bundle}.
 * @param readableMap the {@link WritableMap} to convert.
 * @return the converted {@link Bundle}.
public static Bundle toBundle(@Nullable ReadableMap readableMap) {
  if (readableMap == null) {
    return null;

  ReadableMapKeySetIterator iterator = readableMap.keySetIterator();

  Bundle bundle = new Bundle();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    ReadableType readableType = readableMap.getType(key);
    switch (readableType) {
      case Null:
        bundle.putString(key, null);
      case Boolean:
        bundle.putBoolean(key, readableMap.getBoolean(key));
      case Number:
        // Can be int or double.
        bundle.putDouble(key, readableMap.getDouble(key));
      case String:
        bundle.putString(key, readableMap.getString(key));
      case Map:
        bundle.putBundle(key, toBundle(readableMap.getMap(key)));
      case Array:
        // TODO t8873322
        throw new UnsupportedOperationException("Arrays aren't supported yet.");
        throw new IllegalArgumentException("Could not convert object with key: " + key + ".");

  return bundle;
Example 11
Project: GoalsAndHabits   File:   View Source Code Vote up 5 votes
 * Creates a new instance of the edit event dialog with the given parameters
 * @param comment Event Comment
 * @param location
 * @return
public static EditHabitEventDialog newInstance(String comment, Location location ) {
    EditHabitEventDialog dialog= new EditHabitEventDialog();
    Bundle args = new Bundle();
    args.putString("Comments", comment);
    if (location != null){
        args.putDouble("latitude", location.getLatitude());
        args.putDouble("longitude", location.getLongitude());
    return dialog;
Example 12
Project: FilterBar   File:   View Source Code Vote up 5 votes
 * Overridden to save instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. Other members of this class than the normalized min and max values don't need to be saved.
protected Parcelable onSaveInstanceState() {
    final Bundle bundle = new Bundle();
    bundle.putParcelable("SUPER", super.onSaveInstanceState());
    bundle.putDouble("MIN", normalizedMinValue);
    bundle.putDouble("MAX", normalizedMaxValue);
    return bundle;
Example 13
Project: react-native-upload-file   File:   View Source Code Vote up 4 votes
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
    bundle.putDouble(key, (Double) value);
Example 14
Project: GitHub   File:   View Source Code Vote up 4 votes
public void putDouble(Bundle state, String key, double x) {
    state.putDouble(key + baseKey, x);
Example 15
Project: Library-System-Android   File:   View Source Code Vote up 4 votes
public void onClick(View v) {

        if (v.getId() =={

            Spinner spinner = (Spinner) findViewById(;
            String bookTitle = spinner.getSelectedItem().toString();

            Intent I = new Intent(getApplicationContext(), LoginHold.class);

            //***GET PASSED INFO***
            Bundle extras= getIntent().getExtras();
            int pulledPickUpDayOfYear = extras.getInt("pickUpDayOfYear");
            String pulledYear = extras.getString("pickUpYear");
            String pickUpMonth = extras.getString("pickUpMonth");
            String pickUpDay = extras.getString("pickUpDay");
            String pulledPickUpHour = extras.getString("pickUpHour");
            String pulledPickUpAmPm = extras.getString("pickUpAmPm");
            int dropOffDayOfYear = extras.getInt("dropOffDayOfYear");
            String dropOffYear = extras.getString("dropOffYear");
            String dropOffMonth = extras.getString("dropOffMonth");
            String dropOffDay = extras.getString("dropOffDay");
            String dropOffHour = extras.getString("dropOffHour");
            String dropOffAmPm = extras.getString("dropOffAmPm");
            int rentalHours = extras.getInt("rentalHours");
            String loggedUsername = extras.getString("username");
            int loggedId = extras.getInt("id");

            Double rentalTotal = cost*rentalHours;

            //pass stuff to results
            Bundle extraInfo = new Bundle();

            extraInfo.putInt("rentalHours", rentalHours);

            //pick up data
            extraInfo.putInt("pickUpDayOfYear", pulledPickUpDayOfYear);
            extraInfo.putString("pickUpMonth", pickUpMonth);
            extraInfo.putString("pickUpDay", pickUpDay);
            extraInfo.putString("pickUpYear", pulledYear);
            extraInfo.putString("pickUpHour", pulledPickUpHour);
            extraInfo.putString("pickUpAmPm", pulledPickUpAmPm);

            //Drop off data
            extraInfo.putInt("dropOffDayOfYear", dropOffDayOfYear);
            extraInfo.putString("dropOffYear", dropOffYear);
            //System.out.println("dropOffYear " + year);
            extraInfo.putString("dropOffMonth", dropOffMonth);
            extraInfo.putString("dropOffDay", dropOffDay);
            extraInfo.putString("dropOffHour", dropOffHour);
            extraInfo.putString("dropOffAmPm", dropOffAmPm);

            //transaction stuff
            extraInfo.putString("title", bookTitle);
            extraInfo.putDouble("rentalTotal", rentalTotal);



Example 16
Project: IPCInvoker   File:   View Source Code Vote up 4 votes
public static void put(Bundle bundle, String key, Object value) {
        if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Float) {
            bundle.putFloat(key, (Float) value);
        } else if (value instanceof Character) {
            bundle.putChar(key, (Character) value);
        } else if (value instanceof CharSequence) {
            bundle.putCharSequence(key, (CharSequence) value);
        } else if (value instanceof Long) {
            bundle.putLong(key, (Long) value);
        } else if (value instanceof Short) {
            bundle.putShort(key, (Short) value);
        } else if (value instanceof Byte) {
            bundle.putByte(key, (Byte) value);
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, (Double) value);
        } else if (value instanceof Parcelable) {
            bundle.putParcelable(key, (Parcelable) value);
        } else if (value instanceof Bundle) {
            bundle.putBundle(key, (Bundle) value);
        } else if (value instanceof int[]) {
            bundle.putIntArray(key, (int[]) value);
        } else if (value instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) value);
        } else if (value instanceof float[]) {
            bundle.putFloatArray(key, (float[]) value);
        } else if (value instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) value);
        } else if (value instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) value);
        } else if (value instanceof long[]) {
            bundle.putLongArray(key, (long[]) value);
        } else if (value instanceof Parcelable[]) {
            bundle.putParcelableArray(key, (Parcelable[]) value);
        } else if (value instanceof short[]) {
            bundle.putShortArray(key, (short[]) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else {
//            bundle.putString(key, String.valueOf(value));
Example 17
Project: android-state   File:   View Source Code Vote up 4 votes
public void putDouble(Bundle state, String key, double x) {
    state.putDouble(key + mBaseKey, x);
Example 18
Project: android-state   File:   View Source Code Vote up 4 votes
public void putBoxedDouble(Bundle state, String key, Double x) {
    if (x != null) {
        state.putDouble(key + mBaseKey, x);
Example 19
Project: RxRemote   File:   View Source Code Vote up 4 votes
private void addDataToBundle(Bundle remoteData, Object data, RemoteDataType dataType, String keyPrefix) throws Exception {
    remoteData.putString(RemoteEventManager.REMOTE_DATA_TYPE + keyPrefix,;
    switch (dataType) {
        case List:
            List listData = (List) data;
            int dataSize = listData != null ? listData.size() : 0;
            remoteData.putInt(RemoteEventManager.REMOTE_DATA_LIST_SIZE + keyPrefix, dataSize);
            RemoteDataType itemDataType = null;
            for (int i = 0; i < dataSize; i++) {
                Object item = listData.get(i);
                if (itemDataType == null) {
                    itemDataType = findDataType(item);
                addDataToBundle(remoteData, item, itemDataType, keyPrefix + i);

        case Parcelable:
            remoteData.putParcelable(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Parcelable) data);
        case Parceler:
            writeParceler(data, remoteData, keyPrefix);
        case Remoter:
            writeRemoter(data, remoteData, keyPrefix);
        case Byte:
            remoteData.putByte(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Byte) data);
        case Short:
            remoteData.putShort(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Short) data);
        case Integer:
            remoteData.putInt(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Integer) data);
        case Float:
            remoteData.putFloat(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Float) data);
        case Double:
            remoteData.putDouble(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Double) data);
        case String:
            remoteData.putString(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (String) data);
        case Char:
            remoteData.putChar(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Character) data);
        case Long:
            remoteData.putLong(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Long) data);
        case Boolean:
            remoteData.putInt(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, ((Boolean) data).booleanValue() ? 1 : 0);
        case UnKnown:
            Log.w(TAG, "Ignoring unsupported type " + data);

Example 20
Project: Lyra   File:   View Source Code Vote up 2 votes
 * Write a field's value into the saved state {@link Bundle}.
 * @param state      {@link Bundle} used to save the state
 * @param key        key retrieved from {@code fieldDeclaringClass#fieldName}
 * @param fieldValue value of field
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull Double fieldValue) {
    state.putDouble(key, fieldValue);