简体   繁体   English

如何从 UmmalquraCalendar 单击按钮上的下一个和上一个日期?

[英]How to get next and previous date on button Click from UmmalquraCalendar?

The issue is simple, i want get next and previous date from UmmalQuraCalendar on button click and show it in textview (settext).问题很简单,我想通过单击按钮从 UmmalQuraCalendar 获取下一个和上一个日期,并将其显示在 textview (settext) 中。 Its easy to show current date in textview, but next and previous im unable to get.在 textview 中显示当前日期很容易,但下一个和上一个我无法获得。 Below example code from which i want get them:下面是我想从中获取它们的示例代码:

        UmmalquraCalendar ca = new UmmalquraCalendar();
        ca.get(Calendar.YEAR);
        ca.get(Calendar.MONTH);
        ca.getDisplayName(Calendar.MONTH,Calendar.LONG, Locale.ENGLISH);
        ca.get(Calendar.DAY_OF_MONTH);
        String dtIslamic = ca.getDisplayName(Calendar.MONTH,Calendar.LONG, Locale.ENGLISH)+"-"+ca.get(Calendar.DAY_OF_MONTH)+"-"+ca.get(Calendar.YEAR);
        mHijriDate.setText(dtIslamic);

Calendar.YEAR / MONTH and so on are int arrays (int[]), so doing ca.get(Calendar.DAY_OF_MONTH) - 1 ; Calendar.YEAR / MONTH 等都是 int 数组 (int[]),所以这样做ca.get(Calendar.DAY_OF_MONTH) - 1 should give you the previous day and +1 the next one应该给你前一天和 +1 下一天

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM