Saving String Input on Android
<p>Right, I've been trying to find a solution to this for a good while, but it's just not working for some reason.</p>

<p>In short, what I want to do is save every input String the user inputs into a file. Every time the activity is created again, I want to re-input these strings into a new instance of an object.</p>

<p>This code is what I use to create the file and read info from it, used in the onCreate() method of activity</p>

<pre><code>    try {

        String brain = "brain";
        File file = new File(this.getFilesDir(), brain);
        if (!file.exists()) {
            file.createNewFile();
        }      

        BufferedReader in = new BufferedReader(new FileReader(file));
        String s; // This feeds the object MegaAndroid with the strings, sequentially 
        while ((s = in.readLine()) != null) {
            MegaAndroid.add(s);
        }
        in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
</code></pre>

<p>After that, every time the user inputs some text, the strings are saved onto the file:</p>

<pre><code>    try {

        String brain = "brain";
        File file = new File(this.getFilesDir(), brain);
        if (!file.exists()) {
            file.createNewFile();
        }

    BufferedWriter out = new BufferedWriter(new FileWriter(file));
    out.write(message); // message is a string that holds the user input
    out.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
</code></pre>

<p>For some reason, however, every time the application is killed, the data is lost.
What am I doing wrong?</p>

<p><strong>EDIT</strong>: Also, if I were to access this file from another class, how can I? </p>
