获取本周的Andr​​oid中的日期 [英] Getting the dates of the current week in Android

查看:94
本文介绍了获取本周的Andr​​oid中的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这5个按钮,在我的计划:周一,周二,周三,周四和周五,这是我的菜单屏幕上。我现在想的是,当我的程序启动和我的菜单屏幕打开时,该按钮包含当天的日子+的日期。

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:

周一04/30 周二05/01 周三05/02 周四05/03 周五05/04

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

但是,当我打开菜单画面下周一就应该是这样的: 周一05/07 周二05/08 周三05/09 周四05/10 周五05/11

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?

推荐答案

使用java的Calendar类,有一个答案在这里,可以帮助你设计一个解决方案<一href="http://stackoverflow.com/questions/2937086/how-to-get-the-first-day-of-the-current-week-and-month">How来得到当前一周和一个月的第一天?

Use the java Calendar class, there is an answer here that could help you devise a solution How to get the first day of the current week and month?

这篇关于获取本周的Andr​​oid中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆