android - CountDown Timer not showing number of days left -


I am writing a program in which I am using count down to a specific date and time And as a result I'm getting countdown in hour, minute, second format , but I also want to show the number of days

< Required :

canceled public onTick (Long mixed intro) {string result = horizontal string (new organization. Joda.time.Pieriod (millisUntilFinished)); Countdown.setText ("Time Remaining:" + results); } Private string to redeemable string (Period period) {intDadrens = period.jet (Diffelfieldtype Dies ()); Int hours = period.get (DurationFieldType.hours ()); Int minute = period.gateins (); Int sec = duration. GetSeconds (); Stringbilder sb = new stringbiller (); If (days> 0) {sb.append (day); If (day == 1) {sb.append ("day,"); } Other {sb.append ("days,"); }} If (hours> 0) {sb.append (hours); If (hours == 1) {sb.append ("hour,"); } Other {sb.append ("hours,"); }} If (minutes> 0) {sb.append (min); If (minutes == 1) {sb.append ("minute,"); } Other {sb.append ("minute,"); }} If (secs gt; 0) {sb.append (seconds); If (seconds == 1) {sb.append ("second,"); } Other {sb.append ("seconds,"); }} String result = sb.toString (). Trim (); If (result.endsWith (",")) result = result. Substring (0, result.length () - 1); Return result; }}

In your toReadableString function, only get the number of days of the following hours - You also have to work on other differences:

  int day = hours / 24; Hours = hours% 24; // The rest of the conversion code  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -