android.os.Bundle.putDouble()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(224)

本文整理了Java中android.os.Bundle.putDouble()方法的一些代码示例,展示了Bundle.putDouble()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.putDouble()方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:putDouble

Bundle.putDouble介绍

暂无

代码示例

代码示例来源:origin: androidannotations/androidannotations

public I arg(String key, double value) {
  args.putDouble(key, value);
  return (I) this;
}

代码示例来源:origin: facebook/facebook-android-sdk

public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) {
  if (value == null) {
    bundle.remove(key);
  } else if (value instanceof Boolean) {
    bundle.putBoolean(key, (boolean) value);
  } else if (value instanceof boolean[]) {
    bundle.putBooleanArray(key, (boolean[]) value);
  } else if (value instanceof Double) {
    bundle.putDouble(key, (double) value);
  } else if (value instanceof double[]) {
    bundle.putDoubleArray(key, (double[]) value);
  } else if (value instanceof Integer) {
    bundle.putInt(key, (int) value);
  } else if (value instanceof int[]) {
    bundle.putIntArray(key, (int[]) value);
  } else if (value instanceof Long) {
    bundle.putLong(key, (long) value);
  } else if (value instanceof long[]) {
    bundle.putLongArray(key, (long[]) value);
  } else if (value instanceof String) {
    bundle.putString(key, (String) value);
  } else if (value instanceof JSONArray) {
    bundle.putString(key, value.toString());
  } else if (value instanceof JSONObject) {
    bundle.putString(key, value.toString());
  } else {
    return false;
  }
  return true;
}

代码示例来源:origin: stackoverflow.com

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
 super.onSaveInstanceState(savedInstanceState);
 // Save UI state changes to the savedInstanceState.
 // This bundle will be passed to onCreate if the process is
 // killed and restarted.
 savedInstanceState.putBoolean("MyBoolean", true);
 savedInstanceState.putDouble("myDouble", 1.9);
 savedInstanceState.putInt("MyInt", 1);
 savedInstanceState.putString("MyString", "Welcome back to Android");
 // etc.
}

代码示例来源:origin: facebook/facebook-android-sdk

bundle.putDouble(key, json.getDouble(JSON_VALUE));
} else if (valueType.equals(TYPE_DOUBLE_ARRAY)) {
  JSONArray jsonArray = json.getJSONArray(JSON_VALUE);

代码示例来源:origin: ogaclejapan/SmartTabLayout

/**
 * Inserts a double value into the mapping of this Bundle, replacing
 * any existing value for the given key.
 *
 * @param key   a String, or null
 * @param value a double
 */
public Bundler putDouble(String key, double value) {
 bundle.putDouble(key, value);
 return this;
}

代码示例来源:origin: konmik/nucleus

when(bundle.getFloat(anyString(), anyFloat())).thenAnswer(getOrDefault);
doAnswer(put).when(bundle).putDouble(anyString(), anyDouble());
when(bundle.getDouble(anyString())).thenAnswer(get);
when(bundle.getDouble(anyString(), anyDouble())).thenAnswer(getOrDefault);

代码示例来源:origin: ogaclejapan/SmartTabLayout

/**
 * Inserts a double value into the mapping of this Bundle, replacing
 * any existing value for the given key.
 *
 * @param key   a String, or null
 * @param value a double
 */
public Bundler putDouble(String key, double value) {
 bundle.putDouble(key, value);
 return this;
}

代码示例来源:origin: facebook/facebook-android-sdk

/**
 * Sets a double value in the object.
 * @param key The key for the value.
 * @param value The value.
 * @return The builder.
 */
public E putDouble(final String key, final double value) {
  this.bundle.putDouble(key, value);
  return (E)this;
}

代码示例来源:origin: facebook/facebook-android-sdk

public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
  bundle.putDouble(key, (Double) value);
}

代码示例来源:origin: bluelinelabs/Conductor

public BundleBuilder putDouble(String key, double value) {
  bundle.putDouble(key, value);
  return this;
}

代码示例来源:origin: f2prateek/dart

/**
 * Inserts a double value into the mapping of the underlying Bundle, replacing any existing value
 * for the given key.
 *
 * @param key a String, or null
 * @param value a double
 * @return this bundler instance to chain method calls
 */
public Bundler put(String key, double value) {
 delegate.putDouble(key, value);
 return this;
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putDouble(INITIAL_TEMPO_KEY, initialTempo);
  outState.putDouble(INITIAL_PITCH_KEY, initialPitch);
  outState.putDouble(TEMPO_KEY, getCurrentTempo());
  outState.putDouble(PITCH_KEY, getCurrentPitch());
  outState.putDouble(STEP_SIZE_KEY, getCurrentStepSize());
}

代码示例来源:origin: facebook/facebook-android-sdk

private static void putDouble(String key, Bundle bundle) {
  bundle.putDouble(key, random.nextDouble());
}

代码示例来源:origin: facebook/facebook-android-sdk

private void logEvent() {
  final String eventName = this.mapping.getEventName();
  final Bundle parameters = CodelessMatcher.getParameters(
      mapping,
      rootView.get(),
      hostView.get()
  );
  if (parameters.containsKey(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM)) {
    String value = parameters.getString(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM);
    parameters.putDouble(
        AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM,
        AppEventUtility.normalizePrice(value));
  }
  parameters.putString(Constants.IS_CODELESS_EVENT_KEY, "1");
  final Bundle params = parameters;
  FacebookSdk.getExecutor().execute(new Runnable() {
    @Override
    public void run() {
      final Context context = FacebookSdk.getApplicationContext();
      final AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context);
      appEventsLogger.logEvent(eventName, params);
    }
  });
}

代码示例来源:origin: facebook/facebook-android-sdk

private void logEvent() {
  if (null == mapping) {
    return;
  }
  final String eventName = mapping.getEventName();
  final Bundle parameters = CodelessMatcher.getParameters(
      mapping,
      rootView.get(),
      hostView.get()
  );
  if (parameters.containsKey(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM)) {
    String value = parameters.getString(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM);
    parameters.putDouble(
        AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM,
        AppEventUtility.normalizePrice(value));
  }
  parameters.putString(Constants.IS_CODELESS_EVENT_KEY, "1");
  final Bundle params = parameters;
  FacebookSdk.getExecutor().execute(new Runnable() {
    @Override
    public void run() {
      final Context context = FacebookSdk.getApplicationContext();
      final AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context);
      appEventsLogger.logEvent(eventName, params);
    }
  });
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldValidateSyncExtras() {
 Bundle bundle = new Bundle();
 bundle.putString("foo", "strings");
 bundle.putLong("long", 10L);
 bundle.putDouble("double", 10.0d);
 bundle.putFloat("float", 10.0f);
 bundle.putInt("int", 10);
 bundle.putParcelable("account", a);
 ContentResolver.validateSyncExtrasBundle(bundle);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getDouble() {
 bundle.putDouble("foo", 5);
 assertThat(bundle.getDouble("foo")).isEqualTo(5.0);
 assertThat(bundle.getDouble("bar")).isEqualTo(0.0);
 assertThat(bundle.getDouble("bar", 7)).isEqualTo(7.0);
}

代码示例来源:origin: facebook/facebook-android-sdk

b.putInt("intValue", 7);
b.putLong("longValue", 5000000000l);
b.putDouble("doubleValue", 3.14);
b.putString("stringValue", "hello world");
b.putStringArray("stringArrayValue", new String[] {"first", "second"});

代码示例来源:origin: stackoverflow.com

Intent yourInent = new Intent(thisActivity.this, nextActivity.class);
Bundle b = new Bundle();
b.putDouble("key", doubleVal);
yourIntent.putExtras(b);
startActivity(yourIntent);

代码示例来源:origin: meituan/WMRouter

/**
 * 附加到Intent的Extra
 */
public DefaultUriRequest putExtra(String name, double value) {
  extra().putDouble(name, value);
  return this;
}

相关文章

Bundle类方法