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

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

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

        <legend id='xQFRC'><style id='xQFRC'><dir id='xQFRC'><q id='xQFRC'></q></dir></style></legend>
      2. 将秒值转换为小时分钟秒?

        时间:2023-10-01

          <legend id='6jP9d'><style id='6jP9d'><dir id='6jP9d'><q id='6jP9d'></q></dir></style></legend>

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

            <small id='6jP9d'></small><noframes id='6jP9d'>

                <bdo id='6jP9d'></bdo><ul id='6jP9d'></ul>
                  <tbody id='6jP9d'></tbody>
                • <tfoot id='6jP9d'></tfoot>
                  本文介绍了将秒值转换为小时分钟秒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我一直在尝试将秒值(在 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;
                  }
                  

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

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

                  相关文章

                  最新文章

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

                      <tfoot id='jUnox'></tfoot>