// Constructor from a file private Remote(Context c, String remoteName) { this(); if (remoteName == null) throw new IllegalArgumentException("Name cannot be null"); this.name = remoteName; final Gson gson = new Gson(); File optfile = new File(getRemoteDir(c), OPTIONS_FILE); options = gson.fromJson(FileUtils.read(optfile), Options.class); for (final File f : getRemoteDir(c, remoteName).listFiles()) { if (f.getName().endsWith(BUTTON_EXTENSION)) { Button b = gson.fromJson(FileUtils.read(f), Button.class); addButton(b); } } }