简体   繁体   中英

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). Its easy to show current date in textview, but next and previous im unable to get. 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 ; should give you the previous day and +1 the next one

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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