I am trying to make gallery application in which all media file are arranged in a GridView. It shows latest 1st and oldest last. But I wish to arrange its as according to Dates in GridView. Is this possible? I need you viabl开发者_运维技巧e suggestions. Thanks in advance
What I get from your question is all you have to do is store month as some string value while inserting a particular image then
When you are fetching your data check for the current month then previous and such that. In this case you will face problem in dates like in a month say July which is latest and which is oldest soo for that, I will say
Dont save images in sqlite but in sdcard and create file path of every file in that folder and check the date of creation from that file object and display.
Feel free to ask :)
storing images in db is not the best solution. Store them in some folder, so you can use java.io methods to know the last modification date of the file. The rest is up to the way how you implementing the application. Small example of getting last modification date from some file:
File imageFile = new File("1.png");
long lastModifiedTimestamp = imageFile.lastModified();
Date date = new Date(lastModifiedTimestamp);
精彩评论