Getting the dates of the current week in Android
Asked Answered
A

1

3

I have these 5 buttons in my program: Monday, Tuesday, Wednesday, Thursday and Friday, which are on my menu screen. What I want now is that when my program starts and my menu screen opens, the buttons contain the days + the dates of the day.

For example, today we're the fourth of may (happy Star Wars day!) and the buttons should be like this:

Monday 04/30 Tuesday 05/01 Wednesday 05/02 Thursday 05/03 Friday 05/04

But when I open the menu screen next monday it should be like this: Monday 05/07 Tuesday 05/08 Wednesday 05/09 Thursday 05/10 Friday 05/11

How can I do this?

Annelid answered 4/5, 2012 at 15:27 Comment(2)
Use the java Calendar class, there is an answer here that could help you devise a solution #2937586Metchnikoff
ok ty, I'm quite new to Java and this class Calendar will help me a lotAnnelid
M
0

I guess the following two threads is all you will need to get you started. And as Ian mentioned do go through the android Calendar and Date api's. Although I should mention most of the methods of Date api is deprecated. Calendar is generally preferred.

Android Get Current Time and Date

Display Current Time And Date in Android application

Murine answered 4/5, 2012 at 15:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.