Java tutorial
//package com.java2s; import android.app.Activity; import android.content.SharedPreferences; public class Main { public static final String METRIC_KEY = "USE_METRIC_SYSTEM"; public static final String FILE_KEY = "LiftbookSettingsFile"; public static void SetMetricSystem(Activity a, boolean value) { SharedPreferences sp = a.getSharedPreferences(FILE_KEY, Activity.MODE_PRIVATE); SharedPreferences.Editor ed = sp.edit(); ed.putBoolean(METRIC_KEY, value); ed.commit(); } }