-1

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 viable suggestions. Thanks in advance

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
Balban
  • 718
  • 3
  • 9
  • 24
  • Can you describe us little bit more what have you tried and some code please – ingsaurabh Jul 06 '11 at 12:13
  • yes Offcourse Saurabh... I want to make gallery application in which media file arrage in like below way 5 july media file in grid view 4 july media file in grid view 3 July media file in Grid View and so on. I need to date should appear at every row of view. Thanks. Currently I am writing the codes for that. but I only able to make the media file as grid view in which latest one appear above and oldest one appear last. Thanks – Balban Jul 06 '11 at 12:15
  • Ok and where are these images stored is this your application specific folder or default media folder? – ingsaurabh Jul 06 '11 at 12:25
  • I have stored into sqlite database and I am fetching those path into gallery – Balban Jul 06 '11 at 12:28

2 Answers2

1

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 :)

ingsaurabh
  • 15,249
  • 7
  • 52
  • 81
0

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);
Serhiy
  • 4,073
  • 3
  • 36
  • 66