/** Save this remote to the file system */ public void save(Context c) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); File dir = getRemoteDir(c); FileUtils.clear(dir); for (Button b : buttons) { if (b.id != 0 && b.code != null && !b.code.isEmpty()) { // File f = getNextFile(dir, BUTTON_PREFIX, BUTTON_EXTENSION); File f = new File(dir, BUTTON_PREFIX + b.id + BUTTON_EXTENSION); FileUtils.write(f, gson.toJson(b)); } } File f = new File(dir, OPTIONS_FILE); FileUtils.write(f, gson.toJson(options)); }