I wanted to store JSONObject
in a file.
For the purpose I converted the Object to string and then stored it in a file.
The code that I used is :
String card_string = card_object.toString();
//card_object is the JSONObject that I want to store.
f = new File("/sdcard/myfolder/card3.Xcard");
//file 'f' is the file to which I want to store it.
FileWriter fw = new FileWriter(f);
fw.write(card_string);
fw.close();
The code works as I want it. Now I want to retrieve that object back from the File.
How should I do it? I am getting confused on what to use to read the file ?
an InputStream
or a FileReader
or BufferedReader
or what. I am new to JAVA / android development.
please help. A detailed explanation in simple words regarding what I/O functions to be used in different scenarios (like this) is welcome. I have had a look at documentation but your suggestions are welcome.