How to provide large set of images in Android? - android

I want to use a large set of images in my application, that are used in a gallery view. However using the res folder seems not possible with larger set off images. What is the best way for including the images into my apk?

You can save the images in a database and add your database to the apk (a way to do so described here. You would read images from the database using Cursor.getBlob

Storing all the images in the res folder will be quite a hefty job so what I recommend is that you save all the images on a web server. And then retrieve the required images from their respective URL's. The following link has a full tutorial on retrieving images from a particular URL.
How to download and save an image in Android
Hope it helps.

Related

Android: Working with images and SQLite [duplicate]

This question already has answers here:
What is the best way to store the image in the memory of app?
(4 answers)
Closed 6 years ago.
I'd like to be able to programmatically work with Images, ImageViews, Drawables, and SQLite blobs (byte arrays). I inevitably want to be able to have a program that lets me acquire images from the Gallery app or something similar (ie camera), and then place them in a gallery construct within my app and work with them from there. Storing them in SQLite database's as needed.
I haven't come across anything that works. Much of it is deprecated. I have a simple project that is working with text in a SQLite database, and am now trying images.
If you can show or send me someplace that shows how to work with these constructs that would be great. Though to be more specific for this thread I'll state a few things I'd like to do:
Converting Drawables to ImageViews and converting Drawables to SQLite blobs.
Acquiring images from outside the program and placing them in the Drawables section.
Best constructs for working with images.
Thanks,
convert a image to byte[] and easy to store SQlite db
Don't store images in SQLite, instead of saving images save their path into SQLite, and later you can load image from their path.
and if you are loading images from web then you can use Universal Image Loader. It will display and store images in device memory and you can load images offline anytime with same url.
Instead of saving image as blob, save the image url. Or save it in external file in sd card or phone memory.
To save it in a link,
When the user selects an image from gallery. Call the upload image function ( it can be a BoundService ). You can find it by googling it.
When the upload image is successfull, ull get the image url in Json.
Just save that image link in your sqlite database.
Hope it helps.

how can I programmatically remove the image from a folder “Drawable”?

I am developing an E-commerce application. Here I need to show lots of product images when the app is up. I have stored few product images in the drawable folder to reduce the network usage. I am planning to download delta product images when the new product is added in my back end product inventory and save it in SQLite database.
In the app I have to refer two different path ( drawable and SQLite database) to get all product images.
So how can I move the initial fish images in drawable folder to SQLite database at the time of APK generation OR after the app installation (in onCreate method of my MainActivity). And I also need to delete those initial images in the drawable folder after moving it to SQLite database.
Any suggestions are appreciated. Thank you in advance.
The bottom line is that if you deliver with content bound into your APK, it will remain there. Assuming you're planning on distributing through the Google Play store, the only way to modify this via an app update, which is obviously extremely hacky. So if your goal is to discard initial drawable resources, you cannot do this.
My advice is to compress the images as much as possible and only provide one image size which you can resize at runtime, so use the nodpi drawable resource folder (i.e. drawable-nodpi)
The alternative is to download the images via network. Though you say you don't want to do that the file sizes can be made quite small and so the download fast in most cases, so unless you're sure network connectivity will be a problem for your users it's a viable option.

android:store image array for record in listview

I want to store array of images for different records.There is a list view for records and when user clicks on particular record new activity is started and i want to display the array images there. How can i do it?
I tried storing images into draw able folder and using them with R.id but it makes my app heavy.
there are several way to dealing with it but not solve it!
1: you can store your image in your assets folder. it can help you to manipulate and working with your images.
2: reduce your image resolutions.
3: create a web server and request your image from the server instead of save them in your local storage.
also these are not solution but some good trick to deal with this problem!

What is the best way to save images in Parse?

What am I trying to achieve: Based on some filters by the app user, I want to return a list with text and images.
How am I doing it: I have created a table in Parse and have added a column with object type as 'file'. I have put all the jpg/gif images into that column. (double-click, browse, select image from local computer).
The trouble I am having is, the list takes considerable time (~7 seconds) before it is displayed on my android app.
Is there a better way of handling image data within Parse or should I store images somewhere else (like Amazon S3)?
I am using standard queries for Parse in order to get data, nevertheless, am also checking if there is any code latency. Wanted to confirm if I am correctly handling the image data for back-end or not.
Is there a better way of handling image data within Parse or should I
store images somewhere else (like Amazon S3)?
If your images is not too much or you are using for example(five image) its better to save the into the Assets or Drawable Folder for loading.
and if i correctly knows about this problem, you need to use ProgressBar and one image, before loading the Images in Internet.
Caching images and displaying
Hope this helps.
I am using Parse to store images too, but it's not slow as you said. Since Parse is part of Facebook, I think their infrastructure is the same. There are possible issues:
Internet connection: Slow or on 3G?
Images: files are big?
Let me know which case you are in.
If you just display thumbnail images, I suggest you to process it before saving to Parse by writing Cloud function as describe on their blog. The you just need to use generated thumbnails on your listview/gridview

How to hide the selected images from the gallery from my application

What is the better approach of hiding selected images from the gallery from my application.
Changing the extension of the image with some extension
Problem with appraoch 1: Using file explorer we can view the images
Encryption of images
Storing the images in our local database and deleting the image from the location
Please can any one suggest the best appraoch
1. Chnaging Extention: This is not a good way to do.
2. Encryption of Image: If it is a security reason this is a better ontion but if anyone delete that file then you may face problem.
3. Storing the images in our local database and deleting the image from the location: This is also a good option.
I will suggest you to go with option 3 i.e. Storing the images in our local database and deleting the image from the location.

Categories

Resources