Android examples for android.os:Bundle
get Int value from Bundle by key and handle null value
import android.os.Bundle; public class Main { /**/*from www. j av a2s . com*/ * get int * * @param bundle * @param key * @return */ public static Integer getInt(Bundle bundle, String key) { if (isEmpty(bundle, key)) { return null; } else { return bundle.getInt(key); } } /** * check whether a key is empty * * @param bundle * @param key * @return */ public static boolean isEmpty(Bundle bundle, String key) { return bundle == null || !bundle.containsKey(key); } }