Java tutorial
//package com.java2s; import android.content.Context; import android.preference.PreferenceManager; public class Main { private static final String DEF_KEYBOARD_HEIGHT_KEY = "def_keyboard_height_key"; private static int sDefKeyboardHeight = -1; public static void setDefKeyboardHeight(Context context, int height) { if (sDefKeyboardHeight != height) { PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(DEF_KEYBOARD_HEIGHT_KEY, height) .commit(); sDefKeyboardHeight = height; } } }