- #1
fireflies
- 210
- 12
Hello
I am trying to read data from one activity, save it to a file... and when open another activity I will be able to read that file(by opening it).
I searched for tutorials, all they are showing on the same activity. I figured out how the code works.. but I'm not able to understand what will be the directory (parent directory while saving file). This is getting me confused that how can I make new file if no file still created, or if created then edit that file in the first activity... and how to even get the directory when I want to open it in another activity??
I learned from this page first: https://developer.android.com/training/data-storage/files.html
It is confusing because here
is getting error because of the "context". What will be the context??
I am trying to read data from one activity, save it to a file... and when open another activity I will be able to read that file(by opening it).
I searched for tutorials, all they are showing on the same activity. I figured out how the code works.. but I'm not able to understand what will be the directory (parent directory while saving file). This is getting me confused that how can I make new file if no file still created, or if created then edit that file in the first activity... and how to even get the directory when I want to open it in another activity??
I learned from this page first: https://developer.android.com/training/data-storage/files.html
It is confusing because here
Java:
File file = new File(context.getFilesDir(), filename);
is getting error because of the "context". What will be the context??