I am trying to convert the value of seconds (in a BigDecimal variable) to a string in editText, like "1 hour 22 minutes 33 seconds" or something like that.
I tried this:
String sequenceCaptureTime = ""; BigDecimal roundThreeCalc = new BigDecimal("0"); BigDecimal hours = new BigDecimal("0"); BigDecimal myremainder = new BigDecimal("0"); BigDecimal minutes = new BigDecimal("0"); BigDecimal seconds = new BigDecimal("0"); BigDecimal var3600 = new BigDecimal("3600"); BigDecimal var60 = new BigDecimal("60");
(I have roundThreeCalc, which is the value in seconds, so I'm trying to convert it here.)
hours = (roundThreeCalc.divide(var3600)); myremainder = (roundThreeCalc.remainder(var3600)); minutes = (myremainder.divide(var60)); seconds = (myremainder.remainder(var60)); sequenceCaptureTime = hours.toString() + minutes.toString() + seconds.toString();
Then I set editText to sequnceCaptureTime String. But that did not work. This forces the application to close each time. I am completely beside myself from this depth, any help is greatly appreciated. Happy coding!
java android string android-edittext bigdecimal
rabbitt May 25 '11 at 2:32 a.m. 2011-05-25 02:32
source share