public class PreferenceIO { //The GlobalVars class contains static variables so that they are easily used between different parts of the application public static int getLineColor(Context context) { SharedPreferences prefData = context.getSharedPreferences(GlobalVars.prefsFile, 0); return Color.parseColor(prefData.getString("lineColor", "#ff000000")); } public static int getBackgroundColor(Context context) { SharedPreferences prefData = context.getSharedPreferences(GlobalVars.prefsFile, 0); return Color.parseColor(prefData.getString("backgroundColor", "#ffffffff")); } }