@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; colorHSV = bundle.getFloatArray("color"); super.onRestoreInstanceState(bundle.getParcelable("super")); } else { super.onRestoreInstanceState(state); } }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; normalizedScale = bundle.getFloat("saveScale"); m = bundle.getFloatArray("matrix"); prevMatrix.setValues(m); prevMatchViewHeight = bundle.getFloat("matchViewHeight"); prevMatchViewWidth = bundle.getFloat("matchViewWidth"); prevViewHeight = bundle.getInt("viewHeight"); prevViewWidth = bundle.getInt("viewWidth"); imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered"); viewSizeChangeFixedPixel = (FixedPixel) bundle.getSerializable("viewSizeChangeFixedPixel"); orientationChangeFixedPixel = (FixedPixel) bundle.getSerializable("orientationChangeFixedPixel"); int oldOrientation = bundle.getInt("orientation"); if (orientation != oldOrientation) { orientationJustChanged = true; } super.onRestoreInstanceState(bundle.getParcelable("instanceState")); return; } super.onRestoreInstanceState(state); }
when(bundle.getFloatArray(anyString())).thenAnswer(get);
@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); }
assertArrayEquals(originalBundle.getLongArray(LONG_ARRAY_KEY), cachedBundle.getLongArray(LONG_ARRAY_KEY)); 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));
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; normalizedScale = bundle.getFloat("saveScale"); m = bundle.getFloatArray("matrix"); prevMatrix.setValues(m); prevMatchViewHeight = bundle.getFloat("matchViewHeight"); prevMatchViewWidth = bundle.getFloat("matchViewWidth"); prevViewHeight = bundle.getInt("viewHeight"); prevViewWidth = bundle.getInt("viewWidth"); imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered"); super.onRestoreInstanceState(bundle.getParcelable("instanceState")); return; } super.onRestoreInstanceState(state); }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; normalizedScale = bundle.getFloat("saveScale"); m = bundle.getFloatArray("matrix"); prevMatrix.setValues(m); prevMatchViewHeight = bundle.getFloat("matchViewHeight"); prevMatchViewWidth = bundle.getFloat("matchViewWidth"); prevViewHeight = bundle.getInt("viewHeight"); prevViewWidth = bundle.getInt("viewWidth"); imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered"); super.onRestoreInstanceState(bundle.getParcelable("instanceState")); return; } super.onRestoreInstanceState(state); }
Bundle b = this.getIntent().getExtras(); float original[]; if (b!=null) { original = b.getFloatArray(GLCamTest.TWEETS); } if (original!=null) { //do something with original }
public Parcelable onRestoreInstanceState(Parcelable state) { Bundle bundle = (Bundle) state; radii = bundle.getFloatArray(DATA_RADII); if (radii != null) { radiusLeftTop = radii[0]; radiusRightTop = radii[2]; radiusRightBottom = radii[4]; radiusLeftBottom = radii[6]; } return bundle.getParcelable(SUPER_DATA); } }
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; colorHSV = bundle.getFloatArray("color"); super.onRestoreInstanceState(bundle.getParcelable("super")); } else { super.onRestoreInstanceState(state); } }
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; colorHSV = bundle.getFloatArray("color"); super.onRestoreInstanceState(bundle.getParcelable("super")); } else { super.onRestoreInstanceState(state); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setOpacity(savedState.getInt(STATE_OPACITY)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setOpacity(savedState.getInt(STATE_OPACITY)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setOpacity(savedState.getInt(STATE_OPACITY)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setValue(savedState.getFloat(STATE_VALUE)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setValue(savedState.getFloat(STATE_VALUE)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setSaturation(savedState.getFloat(STATE_SATURATION)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setValue(savedState.getFloat(STATE_VALUE)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setSaturation(savedState.getFloat(STATE_SATURATION)); } }
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setValue(savedState.getFloat(STATE_VALUE)); } }