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?

Confituur
  • 495
  • 1
  • 6
  • 16
  • Use the java Calendar class, there is an answer here that could help you devise a solution https://stackoverflow.com/questions/2937086/how-to-get-the-first-day-of-the-current-week-and-month – Ian Warwick May 04 '12 at 15:34
  • ok ty, I'm quite new to Java and this class Calendar will help me a lot – Confituur May 04 '12 at 15:38

1 Answers1

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

Community
  • 1
  • 1
sultan.of.swing
  • 1,090
  • 1
  • 12
  • 23