【问题标题】:Firebase for Android send and receive imagesFirebase for Android 发送和接收图像
【发布时间】:2015-01-08 07:59:08
【问题描述】:

我正在开发一个基于 Firebase 完成的聊天演示应用程序的 Android 应用程序。 我面临的问题是当我想传输图像时,我不知道如何处理这种情况。 为了发送图像,我将其编码为 Base64 并将其作为字符串发送。那么这里再次解码到图像的过程是怎样的呢?

【问题讨论】:

  • 有链接和代码吗?
  • 如果您在发送时对 base64 进行编码,则在接收时对 base64 进行解码。这些方面都不是 Firebase 特有的。正如@Pedram 已经建议的那样,如果您在问题中包含 MCVE,我们可能会更容易为您提供帮助(请参阅stackoverflow.com/help/mcve)。

标签: android image chat firebase


【解决方案1】:

你必须试试这个。

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

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

【讨论】:

    猜你喜欢
    • 2015-08-16
    • 2012-01-02
    • 2019-08-03
    • 2017-10-24
    • 2016-05-02
    • 1970-01-01
    • 2016-02-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多