本文整理了Java中android.os.Bundle.getDouble()
方法的一些代码示例,展示了Bundle.getDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getDouble()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getDouble
暂无
代码示例来源:origin: stackoverflow.com
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// Restore UI state from the savedInstanceState.
// This bundle has also been passed to onCreate.
boolean myBoolean = savedInstanceState.getBoolean("MyBoolean");
double myDouble = savedInstanceState.getDouble("myDouble");
int myInt = savedInstanceState.getInt("MyInt");
String myString = savedInstanceState.getString("MyString");
}
代码示例来源:origin: konmik/nucleus
when(bundle.getDouble(anyString())).thenAnswer(get);
when(bundle.getDouble(anyString(), anyDouble())).thenAnswer(getOrDefault);
代码示例来源:origin: facebook/facebook-android-sdk
/**
* Gets a double value out of the object.
* @param key The key for the value.
* @param defaultValue The value to return if no value is found for the specified key.
* @return The double value.
*/
public double getDouble(final String key, final double defaultValue) {
return this.bundle.getDouble(key, defaultValue);
}
代码示例来源: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: TeamNewPipe/NewPipe
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
initialTempo = savedInstanceState.getDouble(INITIAL_TEMPO_KEY, DEFAULT_TEMPO);
initialPitch = savedInstanceState.getDouble(INITIAL_PITCH_KEY, DEFAULT_PITCH);
tempo = savedInstanceState.getDouble(TEMPO_KEY, DEFAULT_TEMPO);
pitch = savedInstanceState.getDouble(PITCH_KEY, DEFAULT_PITCH);
stepSize = savedInstanceState.getDouble(STEP_SIZE_KEY, DEFAULT_STEP);
}
}
代码示例来源:origin: facebook/facebook-android-sdk
assertEquals(originalBundle.getFloat(FLOAT_KEY), cachedBundle.getFloat(FLOAT_KEY), TestUtils.DOUBLE_EQUALS_DELTA);
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));
代码示例来源: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
assertEquals(7, finalBundle.getInt("intValue"));
assertEquals(5000000000l, finalBundle.getLong("longValue"));
assertEquals(3.14, finalBundle.getDouble("doubleValue"), TestUtils.DOUBLE_EQUALS_DELTA);
assertEquals("hello world", finalBundle.getString("stringValue"));
代码示例来源:origin: stackoverflow.com
Bundle b = getIntent().getExtras();
double result = b.getDouble("key");
代码示例来源:origin: stackoverflow.com
if (getIntent().getExtras() != null) {
final Bundle bundle = getIntent().getBundleExtra("LOCATION");
mLatitude = bundle.getDouble("LATITUDE");
mLatitude = bundle.getDouble("LONGITUDE");
}
代码示例来源:origin: stackoverflow.com
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == 1){
Bundle extras = data.getExtras();
Double longitude = extras.getDouble("Longitude");
Double latitude = extras.getDouble("Latitude");
}
}
代码示例来源:origin: evernote/android-state
public Double getBoxedDouble(Bundle state, String key) {
if (state.containsKey(key + mBaseKey)) {
return state.getDouble(key + mBaseKey);
}
return null;
}
代码示例来源:origin: LanSoSdk/LanSoEditor_advance
/**
* Overridden to restore 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.
*/
@Override
protected void onRestoreInstanceState(Parcelable parcel) {
final Bundle bundle = (Bundle) parcel;
super.onRestoreInstanceState(bundle.getParcelable("SUPER"));
normalizedMinValue = bundle.getDouble("MIN");
normalizedMaxValue = bundle.getDouble("MAX");
}
代码示例来源:origin: stackoverflow.com
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// Restore UI state from the savedInstanceState.
// This bundle has also been passed to onCreate.
boolean myBoolean = savedInstanceState.getBoolean("MyBoolean");
double myDouble = savedInstanceState.getDouble("myDouble");
int myInt = savedInstanceState.getInt("MyInt");
String myString = savedInstanceState.getString("MyString");
}
代码示例来源:origin: stackoverflow.com
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// Restore UI state from the savedInstanceState.
// This bundle has also been passed to onCreate.
boolean myBoolean = savedInstanceState.getBoolean("MyBoolean");
double myDouble = savedInstanceState.getDouble("myDouble");
int myInt = savedInstanceState.getInt("MyInt");
String myString = savedInstanceState.getString("MyString");
}
代码示例来源:origin: vinsol-spree-contrib/spree-android
/**
* Overridden to restore 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.
*/
@Override
protected void onRestoreInstanceState(Parcelable parcel) {
final Bundle bundle = (Bundle) parcel;
super.onRestoreInstanceState(bundle.getParcelable("SUPER"));
normalizedMinValue = bundle.getDouble("MIN");
normalizedMaxValue = bundle.getDouble("MAX");
}
代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK
/**
* Overridden to restore 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.
*/
@Override
protected void onRestoreInstanceState(Parcelable parcel) {
final Bundle bundle = (Bundle) parcel;
super.onRestoreInstanceState(bundle.getParcelable("SUPER"));
normalizedMinValue = bundle.getDouble("MIN");
normalizedMaxValue = bundle.getDouble("MAX");
}
代码示例来源:origin: rockon999/LeanbackLauncher
public double getCachedNotificationScore(StatusBarNotification sbn) {
Bundle extras = sbn.getNotification().extras;
if (extras == null || !extras.containsKey("cached_score")) {
return -1.0d;
}
return extras.getDouble("cached_score");
}
代码示例来源:origin: CityZenApp/Android-Development
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
latitude = getArguments().getDouble("latitude");
longitude = getArguments().getDouble("longitude");
}
}
代码示例来源:origin: techyourchance/idocare-android
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mCloseRequestViewMvc = new CloseRequestViewMvcImpl(inflater, container);
mCloseRequestViewMvc.registerListener(this);
Bundle args = getArguments();
mRequestId = args.getString(Constants.FIELD_NAME_REQUEST_ID);
// TODO: the only argument should be request ID - use loader in order to load request's info!
mRequestLocation = new Location("none");
mRequestLocation.setLongitude(args.getDouble(Constants.FIELD_NAME_LONGITUDE));
mRequestLocation.setLatitude(args.getDouble(Constants.FIELD_NAME_LATITUDE));
return mCloseRequestViewMvc.getRootView();
}
内容来源于网络,如有侵权,请联系作者删除!