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

    <tfoot id='YHheI'></tfoot>

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

      1. <legend id='YHheI'><style id='YHheI'><dir id='YHheI'><q id='YHheI'></q></dir></style></legend>
      2. 如何将图像转换为base64字符串

        时间:2024-04-14

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

          <legend id='xpfST'><style id='xpfST'><dir id='xpfST'><q id='xpfST'></q></dir></style></legend>
          • <bdo id='xpfST'></bdo><ul id='xpfST'></ul>

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

                1. 本文介绍了如何将图像转换为base64字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将图像转换为 base 64 编码为字符串.从那里以 oma_status-icon xml 格式发送到服务器.

                  I want to convert image to base 64 encode to string. from that to send to server with oma_status-icon xml format.

                  但是我从服务器响应中得到了不受支持的编码......

                  but I am getting unsupported encoding from the server response....

                  还有其他方法可以将图片转base64字符串吗??

                  is there any other way to convert image to base64 string??

                  请..帮助...

                  我的代码是:

                          Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),  R.drawable.image);
                  
                          ByteArrayOutputStream bao = new ByteArrayOutputStream();
                          bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 100, bao);
                          byte [] ba = bao.toByteArray();
                  
                           String ba1=Base64.encodeBytes(ba);
                  

                  推荐答案

                  请使用此代码..

                  Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),  R.drawable.image);
                  ByteArrayOutputStream bao = new ByteArrayOutputStream();
                  bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 100, bao);
                  byte [] ba = bao.toByteArray();
                  String ba1=Base64.encodeToString(ba,Base64.DEFAULT);
                  

                  请导入

                  import android.util.Base64;
                  

                  这篇关于如何将图像转换为base64字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 html5 中的 base64 数据播放音频 下一篇:在Android中将base64字符串转换为图像

                  相关文章

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

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

                  <legend id='xlKx9'><style id='xlKx9'><dir id='xlKx9'><q id='xlKx9'></q></dir></style></legend>

                  <tfoot id='xlKx9'></tfoot>

                      • <bdo id='xlKx9'></bdo><ul id='xlKx9'></ul>