Reputation: 179
Hello Im developing an android app, I have few image files saved in the internal memory of the android device. How can I display them on the app.
The images are in the directory /storage/emulated/0/images_to_display
I'm using javascript. I want to display these images from that particular folder.
Also it would be nice if those images displayed in the App are updated (with newer ones) every time I go to that part of the app (images are updated in the device internal memory by another operation, the image file name won't be changed though)
Any help is appreciated.
Sam
Upvotes: 0
Views: 1299
Reputation: 179
Found the solution:
add plugin : cordova-plugin-file
on the device ready call back add :
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
in the <body>
add : <img src="/storage/emulated/0/path-to-file/img.png">
Upvotes: 1
Reputation: 271
first compile in gradle
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
then
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.tasksProcessingOrder(QueueProcessingType.LIFO)
.build();
ImageLoader.getInstance().init(config);
ImageLoader.getInstance().displayImage("file://" + "/storage/emulated/0/images_to_display");
Upvotes: 1
Reputation: 31
Since you didn't provide any information about what kind of app (Cordova, ReactNative, whatever) you use, it's hard to answer.
For Cordova, maybe you can look at https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/
Upvotes: 1