get Int value from Bundle by key with default value - Android android.os

Android examples for android.os:Bundle

Description

get Int value from Bundle by key with default value

Demo Code

import android.os.Bundle;

public class Main{

    public static int getInt(Bundle bundle, String key, int defaultValue) {
        if (bundle == null || Strings.isEmpty(key)) {
            return defaultValue;
        }/*from w w  w.ja v a 2  s .  c o  m*/

        return bundle.getInt(key, defaultValue);
    }

}

Related Tutorials