In my application, when it loads up, it makes a web call which retrieves a JSON string. I want to store this JSON string to the phone so the application won’t crash if the user loses connection. JSON string is required to set the text of the application. So I am doing this
File myDir = new File(getFilesDir().getAbsolutePath());
FileWriter fw = new FileWriter(myDir + "/jsonMain.txt");
fw.write(sJsonMain);
fw.close();
And then to retrieve it I am doing this
BufferedReader br = new BufferedReader(new FileReader(
myDir + "/jsonMain.txt"));
sStoredJSON = br.readLine();
It works fine with other JSON strings, however it is not with the Large JSON string. I checked the log and it says this
04-26 10:00:44.511: I/global(893): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Could someone please tell me how else I can read in a large string like this?
Thanks in advance!!
try this: