<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字符串

        how to convert an image into base64 string(如何将图像转换为base64字符串)

          <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字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  Android copy image from gallery folder onto SD Card alternative folder(Android将图像从图库文件夹复制到SD卡替代文件夹)
                  Is there a tool to find unused resources in an Android project?(是否有工具可以在 Android 项目中查找未使用的资源?)
                    <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>
                      <tbody id='xlKx9'></tbody>

                    <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>