[Solved] How to work with files?


You should not use external files for this purpose, as they are not secure. Android recommends Shared Preferences for this purpose. Shared Preferences store data in the your app package in an xml file which is only accessible through your app. Data is stored in Key-Value pairs.

To save data:

SharedPreferences prefs = this.getSharedPreferences(
      "com.example.your.package.name", Context.MODE_PRIVATE);
String myTime = getSomeDate();
prefs.edit().putString("Your Key", myTime ).apply();

To read data:

SharedPreferences prefs = this.getSharedPreferences(
              "com.example.your.package.name", Context.MODE_PRIVATE);
String myRetrivedTime = prefs.getString("Your Key", "Default value if no data found"); 

To read more follow this tutorial

solved How to work with files?