I'm new to android so please help me out. I am trying to save my ToDoList in a file so that the next time I open it, all the items are reloaded
This is the code I have so far,
MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
gson = new Gson();
    try {
        BufferedReader br = new BufferedReader(new FileReader("storage.json"));
        Entry e = gson.fromJson(br, Entry.class);
        Log.d("reading", e.toString());
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }}
@Override
protected void onStop() {
    super.onStop();
    json = gson.toJson(mEntries);
    Log.d("jsondata", json);
    try {
        file1 = new FileWriter("storage.json");
        file1.write(json);
        file1.flush();
        file1.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
Entry.java
public class Entry {
String S;
boolean b;
public Entry(String S, boolean b) {
    this.S = S;
    this.b = b;
}
public String getS() {
    return S;
}
public void setS(String S) {
    this.S = S;
}
public void setB(boolean b) {
    this.b = b;
}
public boolean isB() {
    return b;
}
}
How do I proceed from here? In onCreate() I would like to check if the file exists and if yes, import data from file and display on screen.
 
     
     
    