25 lines
761 B
Java
25 lines
761 B
Java
|
package com.example.assignment1;
|
||
|
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.SharedPreferences;
|
||
|
|
||
|
|
||
|
public class EventButtonSharedPreferenceHelper {
|
||
|
|
||
|
private SharedPreferences sharedPreferences;
|
||
|
|
||
|
public EventButtonSharedPreferenceHelper(Context context, EventButton eventButton) {
|
||
|
sharedPreferences = context.getSharedPreferences("FirstEventButtonName", Context.MODE_PRIVATE);
|
||
|
}
|
||
|
|
||
|
public void saveEventButtonName(String eventButtonName) {
|
||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||
|
editor.putString("FirstEventButtonName", eventButtonName);
|
||
|
editor.apply();
|
||
|
}
|
||
|
|
||
|
public String getEventButtonName() {
|
||
|
return sharedPreferences.getString("FirstEventButtonName", null);
|
||
|
}
|
||
|
}
|