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

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

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

Bundle.getDoubleArray介绍

暂无

代码示例

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

/**
 * Gets an array of double values out of the object.
 * @param key The key for the value.
 * @return The double values.
 */
@Nullable
public double[] getDoubleArray(final String key) {
  return this.bundle.getDoubleArray(key);
}

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

@Test
public void doubleArray() {
 double [] arr = new double[] { 1.2, 3.4 };
 bundle.putDoubleArray("foo", arr);
 assertThat(bundle.getDoubleArray("foo")).isEqualTo(arr);
 assertThat(bundle.getDoubleArray("bar")).isNull();
}

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

when(bundle.getDoubleArray(anyString())).thenAnswer(get);

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

@Test
public void getWrongType() {
 bundle.putFloat("foo", 5f);
 assertThat(bundle.getCharArray("foo")).isNull();
 assertThat(bundle.getInt("foo")).isEqualTo(0);
 assertThat(bundle.getIntArray("foo")).isNull();
 assertThat(bundle.getIntegerArrayList("foo")).isNull();
 assertThat(bundle.getShort("foo")).isEqualTo((short) 0);
 assertThat(bundle.getShortArray("foo")).isNull();
 assertThat(bundle.getBoolean("foo")).isFalse();
 assertThat(bundle.getBooleanArray("foo")).isNull();
 assertThat(bundle.getLong("foo")).isEqualTo(0);
 assertThat(bundle.getLongArray("foo")).isNull();
 assertThat(bundle.getFloatArray("foo")).isNull();
 assertThat(bundle.getDouble("foo")).isEqualTo(0.0);
 assertThat(bundle.getDoubleArray("foo")).isNull();
 assertThat(bundle.getString("foo")).isNull();
 assertThat(bundle.getStringArray("foo")).isNull();
 assertThat(bundle.getStringArrayList("foo")).isNull();
 assertThat(bundle.getBundle("foo")).isNull();
 assertThat((Parcelable) bundle.getParcelable("foo")).isNull();
 assertThat(bundle.getParcelableArray("foo")).isNull();
 assertThat(bundle.getParcelableArrayList("foo")).isNull();
 bundle.putInt("foo", 1);
 assertThat(bundle.getFloat("foo")).isEqualTo(0.0f);
}

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

assertArrayEquals(originalBundle.getFloatArray(FLOAT_ARRAY_KEY), cachedBundle.getFloatArray(FLOAT_ARRAY_KEY));
assertEquals(originalBundle.getDouble(DOUBLE_KEY), cachedBundle.getDouble(DOUBLE_KEY), TestUtils.DOUBLE_EQUALS_DELTA);
assertArrayEquals(originalBundle.getDoubleArray(DOUBLE_ARRAY_KEY), cachedBundle.getDoubleArray(DOUBLE_ARRAY_KEY));
assertEquals(originalBundle.getChar(CHAR_KEY), cachedBundle.getChar(CHAR_KEY));
assertArrayEquals(originalBundle.getCharArray(CHAR_ARRAY_KEY), cachedBundle.getCharArray(CHAR_ARRAY_KEY));

代码示例来源:origin: fengdai/FragmentMaster

/**
 * Retrieve extended data from the request.
 *
 * @param name The name of the desired item.
 * @return the value of an item that previously added with putExtra() or
 * null if no double array value was found.
 * @see #putExtra(String, double[])
 */
public double[] getDoubleArrayExtra(String name) {
  return mExtras == null ? null : mExtras.getDoubleArray(name);
}

代码示例来源:origin: kayoSun/Tack

public double[] getDoubles(String key){
  if (mBundle != null) {
    return  mBundle.getDoubleArray(key);
  }
  return null;
}

代码示例来源:origin: evernote/android-state

public double[] getDoubleArray(Bundle state, String key) {
  return state.getDoubleArray(key + mBaseKey);
}

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

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 // ... create your views and your mSeries member must be initialized here

 if (savedInstanceState != null && savedInstanceState.getDoubleArray("xValues") != null) {
  double[] xValues = savedInstanceState.getDoubleArray("xValues");
  double[] yValues = savedInstanceState.getDoubleArray("yValues");
  // create data array
  GraphViewDataInterface[] data = new GraphViewDataInterface[xValues.length];
  for (int i=0;i<xValues.length;i++) {
   data[i] = new GraphViewData(xValues[i], yValues[i]);
  }
  mSeries.resetData(data);
 }
}

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

Bundle bundle = this.getIntent().getExtras();
Double[] double = bundle.getDoubleArray("your_double_key");

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

Intent intent = getIntent();
Bundle bundle = intent.getExtras();
endLatitude = bundle.getDoubleArray(endLatitudeStr);
endLongitude = bundle.getDoubleArray(endLongitudeStr);

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

typeListMap = bundle.getStringArray("typeList");
distanceListMap= bundle.getStringArray("distanceList");
 latListMap=bundle.getDoubleArray("latitude");
 lngListMap=bundle.getDoubleArray("longitude");

代码示例来源:origin: subchannel13/EnchantedFortress

SaveLoad.get().deserialize(this.game, savedInstanceState.getDoubleArray(SaveLoad.SaveKey));

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

double[] adresse = (double[]) bundle.getDoubleArray(Site.LATTITUDE);     
 p = new GeoPoint((int) (adresse[0] * 1E6), (int) (adresse[1] * 1E6));

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

assertThat(dst.getIntArray("intArray"), is(new int[] {1, 1, 1}));
assertThat(dst.getLongArray("longArray"), is(new long[] {1, 1, 1}));
assertThat(dst.getDoubleArray("doubleArray"), is(new double[] {1, 1, 1}));
assertThat(dst.getBooleanArray("booleanArray"), is(new boolean[] {true, true, true}));
assertThat(dst.getStringArray("stringArray"), is(new String[] {"", "", ""}));
assertThat(dstObj.getIntArray("intArray"), is(new int[] {1, 1, 1}));
assertThat(dstObj.getLongArray("longArray"), is(new long[] {1, 1, 1}));
assertThat(dstObj.getDoubleArray("doubleArray"), is(new double[] {1, 1, 1}));
assertThat(dstObj.getBooleanArray("booleanArray"), is(new boolean[] {true, true, true}));
assertThat(dstObj.getStringArray("stringArray"), is(new String[] {"", "", ""}));

代码示例来源:origin: Doist/JobSchedulerCompat

@Test
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void testBundleConstructor() {
  Bundle platformBundle = new Bundle();
  platformBundle.putString("string", "string");
  platformBundle.putInt("int", 0);
  platformBundle.putLong("long", 0);
  platformBundle.putDouble("double", 0);
  platformBundle.putStringArray("string_array", new String[]{"one", "two", "three"});
  platformBundle.putIntArray("int_array", new int[]{1, 2, 3});
  platformBundle.putLongArray("long_array", new long[]{1, 2, 3});
  platformBundle.putDoubleArray("double_array", new double[]{1, 2, 3});
  PersistableBundle bundle = new PersistableBundle(platformBundle);
  assertEquals(platformBundle.getString("string"), bundle.getString("string"));
  assertEquals(platformBundle.getInt("int"), bundle.getInt("int"));
  assertEquals(platformBundle.getLong("long"), bundle.getLong("long"));
  assertEquals(platformBundle.getDouble("double"), bundle.getDouble("double"), 0.01);
  assertArrayEquals(platformBundle.getStringArray("string_array"), bundle.getStringArray("string_array"));
  assertArrayEquals(platformBundle.getIntArray("int_array"), bundle.getIntArray("int_array"));
  assertArrayEquals(platformBundle.getLongArray("long_array"), bundle.getLongArray("long_array"));
  assertArrayEquals(platformBundle.getDoubleArray("double_array"), bundle.getDoubleArray("double_array"), 0.01);
}

相关文章

Bundle类方法