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: AnalyticsManager.java   View Source Code Vote up 6 votes
public static void eventCalculate(Context context,Course course, double grade){
    //Fabric
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_CALCULATION)
            .putCustomAttribute("Course name", course.getName())
            .putCustomAttribute("Course code", course.getCode())
            .putCustomAttribute("Result", grade));

    //Firebase
    Bundle params = new Bundle();
    params.putString("course_name",course.getName());
    params.putString("course_code",course.getCode());
    params.putDouble("result",grade);
    FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_CALCULATION,params);

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

}
 
Example 2
Project: SeafoodBerserker   File: FlyingItem.java   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: CreateEventActivity.java   View Source Code Vote up 6 votes
@Override
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)
        mapView.onSaveInstanceState(mapViewSaveState);
    outState.putBundle(MAP_VIEW_SAVED_STATE, mapViewSaveState);

    super.onSaveInstanceState(outState);
    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: ConversionDialog.java   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();
    dialog.setArguments(args);
    return dialog;
}
 
Example 5
Project: MyFlightbookAndroid   File: ActTimeCalc.java   View Source Code Vote up 5 votes
private void returnValue(double d) {
    Bundle bundle = new Bundle();
    bundle.putDouble(COMPUTED_TIME, d);
    hideKeyboard();

    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
}
 
Example 6
Project: Sega   File: ProfilePage.java   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.user_ID,userId);
    args.putString(ViMarket.currency_ID, cur);
    args.putDouble(ViMarket.currency_RATE, rate);
    fragment.setArguments(args);
    getSupportFragmentManager().beginTransaction().replace(R.id.product_detail_container, fragment).commit();
}
 
Example 7
Project: Sega   File: ProductDetailActivity.java   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());
    fragment.setArguments(args);
    getFragmentManager().beginTransaction().replace(R.id.product_detail_container, fragment).commit();
}
 
Example 8
Project: DDComponentForAndroid   File: UriUtils.java   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)) {
        return;
    }

    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: OhaEnergyUseBillFragment.java   View Source Code Vote up 5 votes
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(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: Arguments.java   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}.
 */
@Nullable
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);
        break;
      case Boolean:
        bundle.putBoolean(key, readableMap.getBoolean(key));
        break;
      case Number:
        // Can be int or double.
        bundle.putDouble(key, readableMap.getDouble(key));
        break;
      case String:
        bundle.putString(key, readableMap.getString(key));
        break;
      case Map:
        bundle.putBundle(key, toBundle(readableMap.getMap(key)));
        break;
      case Array:
        // TODO t8873322
        throw new UnsupportedOperationException("Arrays aren't supported yet.");
      default:
        throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
    }
  }

  return bundle;
}
 
Example 11
Project: GoalsAndHabits   File: EditHabitEventDialog.java   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());
    }
    dialog.setArguments(args);
    return dialog;
}
 
Example 12
Project: FilterBar   File: RangeSeekBar.java   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.
 */
@Override
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: BundleJSONConverter.java   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: Injector.java   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: BookResults.java   View Source Code Vote up 4 votes
public void onClick(View v) {

        if (v.getId() == R.id.choosedate_button){

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

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

            //***GET PASSED INFO***
            Bundle extras= getIntent().getExtras();
            //PickUp
            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");
            //DropOff
            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");
            //Transaction
            int rentalHours = extras.getInt("rentalHours");
            String loggedUsername = extras.getString("username");
            int loggedId = extras.getInt("id");

            //rentalTotal
            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);

            I.putExtras(extraInfo);

            startActivity(I);
        }

    }
 
Example 16
Project: IPCInvoker   File: ParameterHelper.java   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: InjectionHelper.java   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: InjectionHelper.java   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: RemoteEventController.java   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, dataType.name());
    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);
            }
            break;

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

    }
}
 
Example 20
Project: Lyra   File: DoubleCoder.java   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
 */
@Override
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull Double fieldValue) {
    state.putDouble(key, fieldValue);
}