开发者

Bitmap to String using Base64. How can fix it?

The Base64.encode doesn't want to take the argument "image", and I don't know how to figure out. I've never used Base64 before.

Bitmap bm = BitmapFactory.decodeStream(this.getContentResolver().openInputStream(uri));
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();  
                    bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object   
  开发者_运维问答                  byte[] image = baos.toByteArray();

                    String encodedImage = Base64.encode(image);

Edit: I use an external package of Base64 http://iharder.sourceforge.net/current/java/base64/


Base64 encode takes at least two arguments. Perhaps try Base64.encode(image, Base64.DEFAULT)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜