Example usage for android.os Bundle getBoolean

List of usage examples for android.os Bundle getBoolean

Introduction

In this page you can find the example usage for android.os Bundle getBoolean.

Prototype

public boolean getBoolean(String key) 

Source Link

Document

Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.

Usage

From source file:Main.java

public static boolean getBool(Bundle b) {
    return b.getBoolean(BOOL_ARG);
}

From source file:Main.java

public static void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
    isShowing = savedInstanceState.getBoolean("isShowing");
    menuItems = savedInstanceState.getIntArray("drawables");
}

From source file:Main.java

public static boolean getParcelableResentParcelFromSmallParcel(Parcelable parcelable) {
    Bundle bundle = (Bundle) parcelable;
    return bundle.getBoolean(BUNDLE_SMALL_RESENT_PARCEL);
}

From source file:Main.java

public static boolean isFirstPublish(Context context) {
    try {/*from   w  w w.j av a  2 s .c o m*/
        ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                PackageManager.GET_META_DATA);
        Bundle bundle = ai.metaData;
        return bundle.getBoolean("FIRST_LAUNCHER");
    } catch (PackageManager.NameNotFoundException e) {
        return false;
    }
}

From source file:Main.java

public static boolean isEmojiAllowed(EditorInfo editorInfo) {
    Bundle bundle = editorInfo.extras;
    return (bundle != null) && bundle.getBoolean("allowEmoji");
}

From source file:Main.java

public static Boolean getBoolean(Bundle arguments, String key) {
    if (arguments != null && arguments.containsKey(key)) {
        return arguments.getBoolean(key);
    } else {/*w  w w. jav a2s  .co m*/
        return null;
    }
}

From source file:com.google.android.apps.muzei.api.internal.SourceState.java

public static SourceState fromBundle(Bundle bundle) {
    SourceState state = new SourceState();
    Bundle artworkBundle = bundle.getBundle("currentArtwork");
    if (artworkBundle != null) {
        state.mCurrentArtwork = Artwork.fromBundle(artworkBundle);
    }//from w  w  w .  j  av a  2 s.  c  om
    state.mDescription = bundle.getString("description");
    state.mWantsNetworkAvailable = bundle.getBoolean("wantsNetworkAvailable");
    String[] commandsSerialized = bundle.getStringArray("userCommands");
    if (commandsSerialized != null && commandsSerialized.length > 0) {
        for (String s : commandsSerialized) {
            state.mUserCommands.add(UserCommand.deserialize(s));
        }
    }
    return state;
}

From source file:com.geekandroid.sdk.sample.JPushReceiver.java

private static String printBundle(Bundle bundle) {
    StringBuilder sb = new StringBuilder();
    for (String key : bundle.keySet()) {
        if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
            sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
        } else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
            sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
        } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
            if (bundle.getString(JPushInterface.EXTRA_EXTRA).isEmpty()) {
                Log.i(TAG, "This message has no Extra data");
                continue;
            }/*from w  w  w .  ja  v  a2  s .  c  om*/

            try {
                JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
                Iterator<String> it = json.keys();

                while (it.hasNext()) {
                    String myKey = it.next().toString();
                    sb.append("\nkey:" + key + ", value: [" + myKey + " - " + json.optString(myKey) + "]");
                }
            } catch (JSONException e) {
                Log.e(TAG, "Get message extra JSON error!");
            }

        } else {
            sb.append("\nkey:" + key + ", value:" + bundle.getString(key));
        }
    }
    return sb.toString();
}

From source file:com.hivewallet.androidclient.wallet.AddressBookProvider.java

/** Records a photo uri in the photo assets table. Returns {@code true} if the uri was already present. */
public static boolean insertOrUpdatePhotoUri(final Context context, @Nullable final Uri photoUri) {
    if (photoUri == null)
        return false;

    final Uri uri = contentUri(context.getPackageName());
    Bundle bundle = context.getContentResolver().call(uri, METHOD_INSERT_OR_UPDATE_PHOTO_URI,
            photoUri.toString(), null);/*www .j a v  a2s.  co m*/
    return bundle.getBoolean(PHOTO_URI_PRESENT);
}

From source file:android.support.car.ui.CarNavExtender.java

/**
 * Static version of {@link #isExtended()}.
 *//*from w w  w .j a v a  2 s  .  co  m*/
public static boolean isExtended(Notification notification) {
    Bundle extras = NotificationCompat.getExtras(notification);
    if (extras == null) {
        return false;
    }

    extras = extras.getBundle(EXTRA_CAR_EXTENDER);
    return extras != null && extras.getBoolean(EXTRA_IS_EXTENDED);
}