Everytime I run the code I get java.io.FileNotFoundException: search.json: open failed: EROFS (Read-only file system)
here's the code
private static void writeJSearchKey(JSONObject obj) throws IOException {
//write the searchKey value to the json file
FileWriter file = new FileWriter("search.json");
file.write(obj.toString());
file.flush();
file.close();
}
and here's where the JSONObejct comes from (just for the sake of Context)
private static JSONObject writeJsonFile(String key) throws JSONException {
//get searchInput string to JSON file
JSONObject o = new JSONObject();
o.put("searchKey", key);
JSONObject newO= new JSONObject();
newO.put("searchEngine", o);
String oString= newO.toString();
Log.d(TAG, oString);
return newO;
}