Android examples for Android OS:Bundle Get
get As Boolean from Bundle
//package com.book2s; import android.os.Bundle; public class Main { public static boolean getAsBoolean(Bundle b, String key) { if (b == null) { return false; }/*from w ww . j a va 2s.c o m*/ if (!b.containsKey(key)) { return false; } boolean value = false; String s = b.getString(key); if (s == null) { try { value = b.getBoolean(key); } catch (ClassCastException e) { } } else { try { value = Boolean.parseBoolean(s); } catch (NumberFormatException e) { } } return value; } }