• <i id='Rq2Pf'><tr id='Rq2Pf'><dt id='Rq2Pf'><q id='Rq2Pf'><span id='Rq2Pf'><b id='Rq2Pf'><form id='Rq2Pf'><ins id='Rq2Pf'></ins><ul id='Rq2Pf'></ul><sub id='Rq2Pf'></sub></form><legend id='Rq2Pf'></legend><bdo id='Rq2Pf'><pre id='Rq2Pf'><center id='Rq2Pf'></center></pre></bdo></b><th id='Rq2Pf'></th></span></q></dt></tr></i><div id='Rq2Pf'><tfoot id='Rq2Pf'></tfoot><dl id='Rq2Pf'><fieldset id='Rq2Pf'></fieldset></dl></div>

      1. <legend id='Rq2Pf'><style id='Rq2Pf'><dir id='Rq2Pf'><q id='Rq2Pf'></q></dir></style></legend>

      2. <tfoot id='Rq2Pf'></tfoot>
        • <bdo id='Rq2Pf'></bdo><ul id='Rq2Pf'></ul>

        <small id='Rq2Pf'></small><noframes id='Rq2Pf'>

        将秒值转换为小时分钟秒?

        时间:2023-05-28

        • <tfoot id='i7bEX'></tfoot>

          <small id='i7bEX'></small><noframes id='i7bEX'>

                <bdo id='i7bEX'></bdo><ul id='i7bEX'></ul>
                <i id='i7bEX'><tr id='i7bEX'><dt id='i7bEX'><q id='i7bEX'><span id='i7bEX'><b id='i7bEX'><form id='i7bEX'><ins id='i7bEX'></ins><ul id='i7bEX'></ul><sub id='i7bEX'></sub></form><legend id='i7bEX'></legend><bdo id='i7bEX'><pre id='i7bEX'><center id='i7bEX'></center></pre></bdo></b><th id='i7bEX'></th></span></q></dt></tr></i><div id='i7bEX'><tfoot id='i7bEX'></tfoot><dl id='i7bEX'><fieldset id='i7bEX'></fieldset></dl></div>
                • <legend id='i7bEX'><style id='i7bEX'><dir id='i7bEX'><q id='i7bEX'></q></dir></style></legend>
                    <tbody id='i7bEX'></tbody>

                • 本文介绍了将秒值转换为小时分钟秒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在尝试将秒值(在 BigDecimal 变量中)转换为 editText 中的字符串,例如1 小时 22 分 33 秒"或类似的东西.

                  I've been trying to convert a value of seconds (in a BigDecimal variable) to a string in an editText like "1 hour 22 minutes 33 seconds" or something of the kind.

                  我试过了:

                  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");
                  

                  (我有一个roundThreeCalc,它是以秒为单位的值,所以我尝试在这里转换它.)

                  (I have a roundThreeCalc which is the value in seconds so I try 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();
                  

                  然后我将 editText 设置为 sequnceCaptureTime 字符串.但这没有用.它每次都强制关闭应用程序.我在这里完全超出了我的深度,非常感谢任何帮助.快乐编码!

                  Then I set the editText to sequnceCaptureTime String. But that didn't work. It force closed the app every time. I am totally out of my depth here, any help is greatly appreciated. Happy coding!

                  推荐答案

                  你应该有更多的运气

                  hours = roundThreeCalc.divide(var3600, BigDecimal.ROUND_FLOOR);
                  myremainder = roundThreeCalc.remainder(var3600);
                  minutes = myremainder.divide(var60, BigDecimal.ROUND_FLOOR);
                  seconds = myremainder.remainder(var60);
                  

                  这将在每次除法后删除十进制值.

                  This will drop the decimal values after each division.

                  如果这不起作用,试试这个.(我只是写了测试了一下)

                  If that didn't work, try this. (I just wrote and tested it)

                  public static int[] splitToComponentTimes(BigDecimal biggy)
                  {
                      long longVal = biggy.longValue();
                      int hours = (int) longVal / 3600;
                      int remainder = (int) longVal - hours * 3600;
                      int mins = remainder / 60;
                      remainder = remainder - mins * 60;
                      int secs = remainder;
                  
                      int[] ints = {hours , mins , secs};
                      return ints;
                  }
                  

                  这篇关于将秒值转换为小时分钟秒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将光标放在 EditText 中文本的末尾 下一篇:如何从 Android 中每个动态创建的 EditText 获取数据?

                  相关文章

                    <tfoot id='BMvag'></tfoot>
                  1. <legend id='BMvag'><style id='BMvag'><dir id='BMvag'><q id='BMvag'></q></dir></style></legend>

                    <small id='BMvag'></small><noframes id='BMvag'>

                    1. <i id='BMvag'><tr id='BMvag'><dt id='BMvag'><q id='BMvag'><span id='BMvag'><b id='BMvag'><form id='BMvag'><ins id='BMvag'></ins><ul id='BMvag'></ul><sub id='BMvag'></sub></form><legend id='BMvag'></legend><bdo id='BMvag'><pre id='BMvag'><center id='BMvag'></center></pre></bdo></b><th id='BMvag'></th></span></q></dt></tr></i><div id='BMvag'><tfoot id='BMvag'></tfoot><dl id='BMvag'><fieldset id='BMvag'></fieldset></dl></div>

                        <bdo id='BMvag'></bdo><ul id='BMvag'></ul>