Вопрос

How can I save a json object in a file in sdcard?

Это было полезно?

Решение

Just get a String from the JSONObject and write it into the file like this:

String content = json.toString();
FileWriter fw = new FileWriter("path");
BufferedWriter bw = new BufferedWriter(fw);
bw.write(content);
bw.close();

You will of course need to catch/throw exceptions and so on.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top