android - At what point should I save my JSON file? -
I have an app that downloads a JSON file from my server. I would like to save this data so that my other activities are its
The file comes from Httpentity as an inputstream, then it is converted into a string, then on JSONObject. I was originally trying to change the JSON object in a string, and tried to store the string in a file, but when I read it back, the JSON parser does not like the string because the new characters (or Different) have gone.
The diamond is the part that converts:
is = httpEntity.getContent (); Bufferreader Reader = New buffed reader (new input stereo reader ("ISO-885 9-1"), 8); Stringbilder sb = new stringbiller (); String line = null; While ((line = reader. Readline ())! = Null () {sb.append (row + "\ n"); }
So this is a 2 part question
1- at what point should I store the file? (Should I direct inputstream to a file-output stream, or should it be stored after converting it into a string?)
2- After storing my strings and reading it back, why do new lines Change, and what should I do to fix this? (Like the ID it likes to be able to use: jObj = new JSONObject (jsonStr);
)
Comments
Post a Comment