1

I have to display data in Listview in android. For that I am retrieving data from sqlite database, having two column fields "date" and "amount". There are some more column fields but i don't need them. Now I want to show data in Listview weekly basis, with addition of the amount for the given week. Can anyone Please help me. How can I do this.(I thought of using strftime() function also but it add all the previous weeks data in one row. even thought for using Calendar class of java but don't know how can I achieve the solution using that.)

ayush bagaria
  • 199
  • 1
  • 1
  • 10
  • This question is off topic or too broad, you simply asking us to write your code. Post some code and what have you tried so far – Kosh Oct 14 '14 at 16:50
  • @k0sh I am not asking you to write code for me. It will be nice of you if you can tell me how I can achieve this just by describing the process if it is possible. Ty – ayush bagaria Oct 14 '14 at 16:59
  • I didin't quite get it do you have – forcewill Oct 14 '14 at 17:22

1 Answers1

0

If I understand correctly your only problem is to make sure that a week has passed. If so:

I refer you to this solution: (Java / Android) Calculate days between 2 dates and present the result in a specific format , that uses no external Java libraries. You can just save the former list population day, the current day, and use the solution here to get the distance between them in days. Then all that remains is to check if the result >= 7. if so, a week has passed.

Community
  • 1
  • 1
Yuval
  • 237
  • 1
  • 2
  • 7