get Integer from Bundle, if not found return null - Android android.os

Android examples for android.os:Bundle

Description

get Integer from Bundle, if not found return null

Demo Code

import android.os.Bundle;
import android.text.TextUtils;
import java.io.Serializable;

public class Main{

    public static Integer getInt(Bundle arguments, String key) {
        if (arguments.containsKey(key)) {
            return arguments.getInt(key);
        } else {/*from  w  w w . j ava2s  .c o m*/
            return null;
        }
    }

}

Related Tutorials