Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.SharedPreferences;

public class Main {
    public static int getPrefInt(SharedPreferences pref, String key, int def_value) {
        try {
            String value = pref.getString(key, String.valueOf(def_value));
            return Integer.parseInt(value);
        } catch (Exception e) {
            // Do nothing
        }
        return def_value;
    }
}