这就是一个做好的方法,将参数直接对应传进来保存就好了。
public static void dataSave(Context context, int deadlines, int intervals, String Severity, int Width,
int Height, String Colors, int Size, int SinglePageTime, int StotalTime, String font){
try {
SharedPreferences sharedPreferences = context.getSharedPreferences("halou", 0);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt("deadline", deadlines);
editor.putInt("interval", intervals);
editor.putString("severity", Severity);
editor.putInt("width", Width);
editor.putInt("height", Height);
editor.apply();
}catch (Exception e){
e.printStackTrace();
}
}