Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String FILE_NAME = "share_data"; public static void remove(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.remove(key); // SharedPreferencesCompat.apply(editor); editor.commit(); } }