Bundle isEmpty - 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 isEmpty method.

This code example shows how to use the following methods:isEmpty, putBoolean
    assertEquals(0, bundle.size());
  } 
 
  @Test 
  public void testIsEmpty() { 
    assertTrue(bundle.isEmpty());
    bundle.putBoolean("foo", true);
    assertFalse(bundle.isEmpty());
  } 
 
  @Test 
  public void testStringArray() { 
    bundle.putStringArray("foo", new String[] { "a" });
    Assert.assertArrayEquals(new String[] { "a" }, bundle.getStringArray("foo"));
    assertNull(bundle.getStringArray("bar"));
  } 
 
  @Test 
  public void testStringArrayList() { 
    ArrayList<String> list = new ArrayList<String>();
7
CodeRank
This code example shows how to use the following methods:isEmpty, putBoolean
        assertEquals(0, bundle.size());
    } 
 
    @Test 
    public void testIsEmpty() { 
        assertTrue(bundle.isEmpty());
        bundle.putBoolean("foo", true);
        assertFalse(bundle.isEmpty());
    } 
 
    @Test 
    public void testStringArray() { 
        bundle.putStringArray("foo", new String[] { "a" });
        Assert.assertArrayEquals(new String[] { "a" }, bundle.getStringArray("foo"));
        assertNull(bundle.getStringArray("bar"));
    } 
 
    @Test 
    public void testStringArrayList() { 
        ArrayList<String> list = new ArrayList<String>();
7
CodeRank
This code example shows how to use the following methods:isEmpty, putBoolean
 
    } 
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        if (outState.isEmpty()) {
            outState.putBoolean(ListMapFragment.BUG_1997_FIX, true);
        } 
        super.onSaveInstanceState(outState);
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
 
        if (item.getItemId() == R.id.clear_map) {
            mPostFragment.createDialog(ListMapFragment.DIALOG_CLEAR_DEPLOYMENT);
            return true; 
        } else if (item.getItemId() == R.id.menu_find) {
 
            mPostFragment.createDialog(ListMapFragment.DIALOG_DISTANCE);
7
CodeRank
This code example shows how to use the following methods:getString, isEmpty, toString
        GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
        // The getMessageType() intent parameter must be the intent you received 
        // in your BroadcastReceiver. 
        String messageType = gcm.getMessageType(intent);
 
        if (!extras.isEmpty()) {
            if (GoogleCloudMessaging. 
                    MESSAGE_TYPE_MESSAGE.equals(messageType)) {
 
                Log.i(LOG_TAG, "Received: " + extras.toString());
 
                if(extras.getString("type","none").equals("upcoming_event")) {
                    sendEventNotification(extras);
                } 
            } 
        } 
 
        // Release the wake lock provided by the WakefulBroadcastReceiver. 
        GCMReceiver.completeWakefulIntent(intent);
    } 
7
CodeRank
This code example shows how to use the following methods:isEmpty, putBoolean
        } 
    } 
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        if (outState.isEmpty()) {
            outState.putBoolean("bug_19917_fix", true);
        } 
        super.onSaveInstanceState(outState);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:isEmpty
    return realIntent;
  } 
 
  @Implementation 
  public Bundle getExtras() {
    return extras.isEmpty() ? null : new Bundle(extras);
  } 
 
  @Implementation 
  public Intent putExtra(String key, int value) {
    extras.putInt(key, value);
    return realIntent;
  } 
 
  @Implementation 
  public Intent putExtra(String key, double value) {
    extras.putDouble(key, value);
    return realIntent;
  } 
 
6
CodeRank
This code example shows how to use the following methods:isEmpty
        return realIntent;
    } 
 
    @Implementation 
    public Bundle getExtras() {
        return extras.isEmpty() ? null : new Bundle(extras);
    } 
 
    @Implementation 
    public Intent putExtra(String key, int value) {
        extras.putInt(key, value);
        return realIntent;
    } 
 
    @Implementation 
    public Intent putExtra(String key, double value) {
        extras.putDouble(key, value);
        return realIntent;
    } 
 
6
CodeRank
This code example shows how to use the following methods:isEmpty
  } 
 
  @Override public String toString() {
    String toString = getClass().getSimpleName() + "{groupId=" + mGroupId;
    toString += ", startId=" + mStartId;
    if (!mArgs.isEmpty()) {
      toString += ", arguments=" + mArgs;
    } 
    if (mReceiver != null) {
      toString += ", receiver=" + mReceiver;
    } 
    if (mRedelivered) {
      toString += ", redelivered";
    } 
    if (mQuittingReason != 0) {
      switch (mQuittingReason) {
        case CANCEL_ALL:
          toString += ", quittingReason=CANCEL_ALL";
          break; 
        case SERVICE_DESTROYED:
5
CodeRank

Related Bundle isEmpty Questions & Answers:

isEmpty Method Overview
Returns true if the mapping of this Bundle is empty, false otherwise.
See Code Examples for other Android Bundle Methods: