Not Able To Load Image From Android Internal Memory Using Cordova File System Api
Develop web app from Android using Worklight 6.2 (Cordova 3.4) I am not able to load image using Cordova file system api: function onFileSystemSuccess(fileSystem) { var filePa
Solution 1:
I am not sure where you are actually trying to read the file. If the file you are reading is in the asset folder like /www then you cant access it using the Cordova file API. Check this link for more information. https://stackoverflow.com/a/8966227/3456790
However, you could use a cordova plugin to read a file using native code. You could do something like this.
AssetManager assetManager = cordova.getActivity().getAssets();
inputStream = assetManager.open("www/default/data/" + fileName + ".json" );
if(inputStream != null) {
buffer = new byte[inputStream.available()];
inputStream.read(buffer);
logger.info("Found file " + fileName);
jsonResult = newJSONArray(newString(buffer, "UTF-8"));
}
Hope that gives you some ideas.
Post a Comment for "Not Able To Load Image From Android Internal Memory Using Cordova File System Api"