Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.os.Bundle;

public class Main {
    public static final int DEFAULT_INT_VALUE = 0;

    /**
     * Retrieves int value from bundle if present.
     *
     * @param bundle to get from
     * @param key    to search by
     * @return value or {@link #DEFAULT_INT_VALUE} if nothing found
     */
    public static int getInt(Bundle bundle, String key) {
        if (bundle != null && bundle.containsKey(key)) {
            return bundle.getInt(key);
        } else {
            return DEFAULT_INT_VALUE;
        }
    }
}