我卡在某事上了。我想要的是获取系统日期和时间,将其存储在字符串中,然后在其他字符串中添加随机时间,然后使用 if else 将它们相互比较(例如
if(dateTime1 > dateTime2) {
}
然后我想显示 gmail 中显示的消息(如果邮件是今天发送的,gmail 会显示今天下午 5 点的时间)。我想在 text Boxes 中显示所有这些。我想要今天下午 4 点、昨天下午 4 点这样的消息,如果超过一周,则只需显示日期和时间。需要你的帮助希望你得到我想要的。请帮助我。这是我到目前为止所做的。还尝试了很多其他的东西。
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView ShowDate = (TextView) findViewById(R.id.ShowDate);
TextView ShowToday = (TextView) findViewById(R.id.ShowToday);
TextView ShowWeek = (TextView) findViewById(R.id.ShowWeek );
TextView ShowAgo = (TextView) findViewById(R.id.ShowAgo );
Calendar ci = Calendar.getInstance();
String CiDateTime = "" + ci.get(Calendar.YEAR) + "-" +
(ci.get(Calendar.MONTH) + 1) + "-" +
ci.get(Calendar.DAY_OF_MONTH) + " " +
ci.get(Calendar.HOUR) + ":" +
ci.get(Calendar.MINUTE) + ":" +
ci.get(Calendar.SECOND);