Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.preference.PreferenceManager; public class Main { private final static String TYPE_PRE = "type_"; /** * @Title: saveSettingRingtone * @Description: Save current setting ring tone * @param context * @param type * @param id * @return void * @throws */ public static void saveSettingRingtone(Context context, int type, String id) { SharedPreferences mSharePref = PreferenceManager.getDefaultSharedPreferences(context); Editor mEditor = mSharePref.edit(); mEditor.putString(TYPE_PRE + type, id); mEditor.commit(); } }