Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; public class Main { public static final String APP_LIST = "list"; public static List<String> getPackage(Context context) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); Gson gson = new Gson(); String json = sharedPrefs.getString(APP_LIST, null); Type type = new TypeToken<ArrayList<String>>() { }.getType(); return gson.fromJson(json, type); } }