Bundle containsKey - 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 containsKey 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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getString
                String authTokenType, String[] requiredFeatures, Bundle options)
                throws NetworkErrorException { 
            // There are two cases here: 
            // 1) We are called with a username/password; this comes from the traditional email 
            //    app UI; we simply create the account and return the proper bundle 
            if (options != null && options.containsKey(OPTIONS_PASSWORD)
                    && options.containsKey(OPTIONS_USERNAME)) {
                final Account account = new Account(options.getString(OPTIONS_USERNAME),
                        TEST_ACCOUNT_TYPE);
                AccountManager.get(EasTestAuthenticatorService.this).addAccountExplicitly(
                            account, options.getString(OPTIONS_PASSWORD), null);
 
                Bundle b = new Bundle();
                b.putString(AccountManager.KEY_ACCOUNT_NAME, TEST_ACCOUNT_TYPE);
                return b;
            // 2) The other case is that we're creating a new account from an Account manager 
            //    activity.  In this case, we add an intent that will be used to gather the 
            //    account information... 
            } else { 
                Bundle b = new Bundle();
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getInt
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getParcelable
        assertTrue(request != null);
 
        Bundle parameters = request.getParameters();
        assertTrue(parameters != null);
 
        assertTrue(parameters.containsKey("picture"));
        assertEquals(image, parameters.getParcelable("picture"));
        assertEquals("me/photos", request.getGraphPath());
    } 
 
    @SmallTest 
    @MediumTest 
    @LargeTest 
    public void testCreatePlacesSearchRequestWithLocation() { 
        Location location = new Location("");
        location.setLatitude(47.6204);
        location.setLongitude(-122.3491);
 
        Request request = Request.newPlacesSearchRequest(null, location, 1000, 50, null, null);
 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getStringArrayList
     
    public static List<String> getHeardFromDirect(Bundle bundle)
    { 
        List<String> results = new ArrayList<String>();
        if ((bundle != null)
                && bundle.containsKey(SpeechRecognizer.RESULTS_RECOGNITION))
        { 
            results =
                bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
        } 
        return results;
    } 
 
    public static float[] getConfidenceFromDirect(Bundle bundle)
    { 
        float [] scores = null;
        if ((bundle != null)
                && bundle.containsKey(SpeechRecognizer.RESULTS_RECOGNITION))
        { 
            scores =

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getString
        super.onResume(); 
    } 
     
    private void restoreState(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            if (savedInstanceState.containsKey(BUNDLE_LAST_SEARCH)) {
                mLastSearch = savedInstanceState.getString(BUNDLE_LAST_SEARCH);
            } 
        } 
    } 
     
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        saveState(outState);
    } 
 
    private void saveState(Bundle outState) {
        outState.putString(BUNDLE_LAST_SEARCH, mLastSearch);
    } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getFloat, getFloatArray, getParcelable
 
	@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)));
		if (savedState.containsKey(STATE_SATURATION)) {
			setSaturation(savedState.getFloat(STATE_SATURATION));
		} else { 
			setValue(savedState.getFloat(STATE_VALUE));
		} 
	} 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getBoolean, getInt, getString
        args[0] = bundle;
 
        configBundle = getIntent().getBundleExtra("RubotoActivity Config");
 
        if (configBundle != null) {
            if (configBundle.containsKey("Theme")) {
                setTheme(configBundle.getInt("Theme"));
            } 
            if (configBundle.containsKey("Script")) {
                if (this.getClass().getName() == RubotoActivity.class.getName()) {
                    setScriptName(configBundle.getString("Script"));
                } else { 
                    throw new IllegalArgumentException("Only local Intents may set script name.");
                } 
            } 
        } 
 
        super.onCreate(bundle);
     
        if (JRubyAdapter.isInitialized()) { 

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:containsKey, getStringArrayList
savedInstanceState.putStringArrayList("history", history);
    } 
     
    public void onRestoreInstanceState(Bundle savedInstanceState) {
    	if (savedInstanceState.containsKey("history")) {
			ArrayList<String> history = new ArrayList<String>();
			history = savedInstanceState.getStringArrayList("history");
			initAdapter(history);
		} 
    } 
     
    @Override 
    public boolean performClick() { 
    	if (adapter.getCount() > 0) showDropDown();
    	return super.performClick(); 
    } 
     
    public String getHistoryString() {
    	StringBuilder string = new StringBuilder();
7
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Bundle containsKey Questions & Answers:

containsKey Method Overview
Returns true if the given key is contained in the mapping of this Bundle.
See Code Examples for other Android Bundle Methods: