1

I have tried searching online to find a solution or some way that I can learn how to read the integer, but alas I have come here to see if any of you guys can help me.

Please & Thank you

public void writetofile() {
    try {
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(openFileOutput("intvalue.txt", Context.MODE_PRIVATE));
        outputStreamWriter.write(Counter);
        outputStreamWriter.close();
    } catch (IOException e) {
        Log.v("MyActivity", e.toString());
    }
}

public int readfromfile() {
    int Counter = 0;

    return Counter;
}
John Solly
  • 31
  • 5

1 Answers1

0

For now read this: https://www.tutorialspoint.com/java/java_files_io.htm

From what is see i recommend Shared preferences: How to use SharedPreferences in Android to store, fetch and edit values

And learning java programming once and not searching little by little saves a lot of time. there are some good free eBooks: http://math.hws.edu/javanotes/

M.Mavini
  • 589
  • 8
  • 20