Hi, im try to prgramm my first Extension, but i need some help, i want the user to be able to select an Asset in the Designer e.g.
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_ASSET) @SimpleProperty(description = "Language File") public void langFile(String langFile) { this.langFile = langFile; }
Now i want to read that file
if (MediaUtil.isExternalFile(path) &&
container.$form().isDeniedPermission(Manifest.permission.READ_EXTERNAL_STORAGE))
{
container.$form().askPermission(Manifest.permission.READ_EXTERNAL_STORAGE,
new PermissionResultHandler() {
@Override
public void HandlePermissionResponse(String permission, boolean granted) {
if (granted) {
readJson(path);
} else {
container.$form().dispatchPermissionDeniedEvent(AutoI18N.this, "Json", permission);
}
}
});
return;
}
jsonPath = (path == null) ? "" : path;
Gson gson = new Gson();
JsonReader reader;
try {
reader = new JsonReader(new FileReader(jsonPath));
Map trans = gson.fromJson(reader.toString(), Map.class);
translations = gson.fromJson(trans.get("en").toString(), Map.class);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
but nothing happens, what am i doing wrong ?