I am creating an image gallery application and you want to sort images by date, but when I use the method lastModified() 5000 files in folders or more, the list becomes very slow. My question is, as the native Android Gallery and other apps like QuickPic can do the listing by date so fast, even with many files?
The answer to my question is in use of the media store images!
Get list of photo galleries on Android
Related
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.
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.
I have a local database which has paths for all images and it's all stored in a single folder on sdcard. Help me to sort & display all those images like today's photos comes first under the title Today, then Yesterday, Last Week and so on. Refer the sample image to have more clarity on this question
you can try to learn it from following free source code on github
https://github.com/lawloretienne/ImageGallery
https://github.com/dibakarece/OwnGalleryView
You can see the file last modified time by using file.lastModified() this will return last modified time. Then you can put your segregation logic based this time.
I want to categorize the images on my device and display it in different albums where the albums look like a stack or deck of images. This is quite a common feature in the default gallery, or applications like QuickPic etc.
How is this achieved? Is it a straightforward effort?
What is the estimated time reqiured for this effort?
You can get the images from the device and put them into different folders. Your app logic would recognize each folder as an album. Then a layout would be created which would display each album with the top 3 or 5 random images in it as a deck of cards (use a relative layout for this to place images on top of one another and use can use a transform function to rotate them slightly if you want also). For each album you would have one deck of cards,and when the user selects an album, you would launch another activity which would be your custom android gallery for displaying the images in a particular album. Here's a good tutorial for how to build one of these custom galleries:
http://mobile.tutsplus.com/tutorials/android/android-sdk-displaying-images-with-an-enhanced-gallery/
As for the time requirement, it's really depends on your skill level. It can range from about a week to 2 months or more I suppose. It isn't very hard to do once you get the hang of the basics of the android file system, a bit of graphics and manipulating the gallery.
Hope this helps :-)
I am making a game in which I want user to give some featured items at run time from server. Currently I am saving images as Blob in sqlite db and that is really putting bad impact in overall performance.
If I write images on SD card then there are following possible two scenarios.
1) All mobiles do not have SD card
2) Any one can see/reuse/delete images
I don't want these things to happen. Is there any way that I can save images in drawable folder where no one except me can see images?