Bundle putFloat - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Bundle putFloat method.

This code example shows how to use the following methods:containsKey, putFloat, remove
    assertEquals(0, bundle.getFloat("foo"), 0.005f);
  } 
 
  @Test 
  public void testRemove() { 
    bundle.putFloat("foo", 5f);
    bundle.putFloat("foo2", 5f);
 
    bundle.remove("foo");
 
    assertFalse(bundle.containsKey("foo"));
    assertTrue(bundle.containsKey("foo2"));
  } 
 
  @Test 
  public void testClear() { 
    bundle.putFloat("foo", 5f);
 
    bundle.clear();
 
9
CodeRank
This code example shows how to use the following methods:putFloat, putParcelable
	/* (non-Javadoc) 
	 * @see android.view.View#onSaveInstanceState() 
	 */ 
	@Override 
	protected Parcelable onSaveInstanceState() {
		final Bundle bundle = new Bundle();
		bundle.putParcelable(INSTNACE_STATE_SAVEDSTATE, super.onSaveInstanceState());
		bundle.putFloat(INSTNACE_STATE_PROGRESS, mProgress);
		bundle.putFloat(INSTNACE_STATE_MARKER_PROGRESS, mMarkerProgress);
		return bundle;
	} 
 
	/** 
	 * Compute insets. 
	 * _______________________ 
	 * |_________dx/2_________| 
	 * |......|.�''''`.|......| 
	 * |-dx/2-|| View ||-dx/2-| 
	 * |______|`.____.�|______| 
	 * |________ dx/2_________| 
7
CodeRank
This code example shows how to use the following methods:containsKey, putFloat, remove
        assertEquals(0, bundle.getFloat("foo"), 0.005f);
    } 
 
    @Test 
    public void testRemove() { 
        bundle.putFloat("foo", 5f);
        bundle.putFloat("foo2", 5f);
 
        bundle.remove("foo");
 
        assertFalse(bundle.containsKey("foo"));
        assertTrue(bundle.containsKey("foo2"));
    } 
 
    @Test 
    public void testClear() { 
        bundle.putFloat("foo", 5f);
 
        bundle.clear();
 
8
CodeRank
This code example shows how to use the following methods:putFloat, putInt
                outBundle.putCharSequence(name, cs);
            } else if (v.type == TypedValue.TYPE_INT_BOOLEAN) {
                outBundle.putBoolean(name, v.data != 0);
            } else if (v.type >= TypedValue.TYPE_FIRST_INT
                    && v.type <= TypedValue.TYPE_LAST_INT) {
                outBundle.putInt(name, v.data);
            } else if (v.type == TypedValue.TYPE_FLOAT) {
                outBundle.putFloat(name, v.getFloat());
            } else { 
                sa.recycle();
                throw new XmlPullParserException("<" + tagName
                        + "> only supports string, integer, float, color, and boolean at " 
                        + attrs.getPositionDescription());
            } 
        } else { 
            sa.recycle();
            throw new XmlPullParserException("<" + tagName
                    + "> requires an holo:value attribute at " + attrs.getPositionDescription());
        } 
        sa.recycle();
7
CodeRank
This code example shows how to use the following methods:putFloat, putParcelable
 
	@Override 
	protected Parcelable onSaveInstanceState() {
		Parcelable superState = super.onSaveInstanceState();
 
		Bundle state = new Bundle();
		state.putParcelable(STATE_PARENT, superState);
		state.putFloat(STATE_ANGLE, mAngle);
 
		return state;
	} 
 
	@Override 
	protected void onRestoreInstanceState(Parcelable state) {
		Bundle savedState = (Bundle) state;
 
		Parcelable superState = savedState.getParcelable(STATE_PARENT);
		super.onRestoreInstanceState(superState);
 
		mAngle = savedState.getFloat(STATE_ANGLE);
8
CodeRank
This code example shows how to use the following methods:putFloat, putFloatArray, putParcelable
 
	@Override 
	protected Parcelable onSaveInstanceState() {
		Parcelable superState = super.onSaveInstanceState();
 
		Bundle state = new Bundle();
		state.putParcelable(STATE_PARENT, superState);
		state.putFloatArray(STATE_COLOR, mHSVColor);
 
		float[] hsvColor = new float[3];
		Color.colorToHSV(mColor, hsvColor);
		state.putFloat(STATE_VALUE, hsvColor[2]);
 
		return state;
	} 
 
	@Override 
	protected void onRestoreInstanceState(Parcelable state) {
		Bundle savedState = (Bundle) state;
 
7
CodeRank
This code example shows how to use the following methods:putBoolean, putDouble, putFloat, putInt, putLong
        final Account account2 = new Account("b@example.com", "example.type.2");
        final String authority1 = "testprovider1";
        final String authority2 = "testprovider2";
        final Bundle extras1 = new Bundle();
        extras1.putString("a", "1");
        final Bundle extras2 = new Bundle();
        extras2.putString("a", "2");
        extras2.putLong("b", 2);
        extras2.putInt("c", 1);
        extras2.putBoolean("d", true);
        extras2.putDouble("e", 1.2);
        extras2.putFloat("f", 4.5f);
        extras2.putParcelable("g", account1);
        final int period1 = 200;
        final int period2 = 1000;
 
        PeriodicSync sync1 = new PeriodicSync(account1, authority1, extras1, period1);
        PeriodicSync sync2 = new PeriodicSync(account1, authority1, extras2, period1);
        PeriodicSync sync3 = new PeriodicSync(account1, authority2, extras1, period1);
        PeriodicSync sync4 = new PeriodicSync(account1, authority2, extras2, period2);
8
CodeRank
This code example shows how to use the following methods:putFloat, putFloatArray, putParcelable
 
	@Override 
	protected Parcelable onSaveInstanceState() {
		Parcelable superState = super.onSaveInstanceState();
 
		Bundle state = new Bundle();
		state.putParcelable(STATE_PARENT, superState);
		state.putFloatArray(STATE_COLOR, mHSVColor);
		 
		float[] hsvColor = new float[3];
		Color.colorToHSV(mColor, hsvColor);
		state.putFloat(STATE_SATURATION, hsvColor[1]);
 
		return state;
	} 
 
	@Override 
	protected void onRestoreInstanceState(Parcelable state) {
		Bundle savedState = (Bundle) state;
 
7
CodeRank
This code example shows how to use the following methods:putFloat
    return realIntent;
  } 
 
  @Implementation 
  public Intent putExtra(String key, float value) {
    extras.putFloat(key, value);
    return realIntent;
  } 
 
  @Implementation 
  public Intent putExtra(String key, long value) {
    extras.putLong(key, value);
    return realIntent;
  } 
 
  @Implementation 
  public Intent putExtra(String key, Serializable value) {
    extras.putSerializable(key, serializeCycle(value));
    return realIntent;
  } 
6
CodeRank
This code example shows how to use the following methods:putFloat, putFloatArray, putParcelable
 
	@Override 
	protected Parcelable onSaveInstanceState() {
		Parcelable superState = super.onSaveInstanceState();
 
		Bundle state = new Bundle();
		state.putParcelable(STATE_PARENT, superState);
		state.putFloatArray(STATE_COLOR, mHSVColor);
		float[] hsvColor = new float[3];
		Color.colorToHSV(mColor, hsvColor);
		if (hsvColor[1] < hsvColor[2]) {
			state.putFloat(STATE_SATURATION, hsvColor[1]);
		} else { 
			state.putFloat(STATE_VALUE, hsvColor[2]);
		} 
 
		return state;
	} 
 
	@Override 
7
CodeRank

Related Bundle putFloat Questions & Answers:

putFloat Method Overview
Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key.
See Code Examples for other Android Bundle Methods: