火力地堡为Android发送和接收图像 [英] Firebase for Android send and receive images

查看:198
本文介绍了火力地堡为Android发送和接收图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发对火力地堡进行聊天演示应用Android应用基地。
我现在面临的问题是,当我想传输图像,我不知道如何处理这种情况。
为Base64编码发送图像I EN code,并把它作为一个字符串。那么怎么会在这里再次向解码图像的过程吗?

I am developing an Android application base on chat demo application done by Firebase. The problem I'm facing is when I want to transfer images, I don't know how to handle the situation. for sending the image I encode it in Base64 and send it as a string. So how will be the process of decoding to the image again here?

推荐答案

您一定要试试这个。

字节[] = imageAsBytes Base64.de code(字符串,Base64.DEFAULT);

byte[] imageAsBytes = Base64.decode(String,Base64.DEFAULT);

BMP位图= BitmapFactory.de codeByteArray的(imageAsBytes,0,imageAsBytes.length);

Bitmap bmp = BitmapFactory.decodeByteArray(imageAsBytes, 0,imageAsBytes.length);

这篇关于火力地堡为Android发送和接收图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆