Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

java - Getting the dates of the current week in Android

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...