如何解决SkImageDe codeR ::厂返回null [英] How to solve the SkImageDecoder::Factory returned null

查看:145
本文介绍了如何解决SkImageDe codeR ::厂返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在code:

URL url = new URL(bitmapurl);

HttpURLConnection connection = (HttpURLConnection) url.openConnection();
     connection.setDoInput(true);
      connection.connect();
 InputStream input = connection.getInputStream();

bitmap[i] = BitmapFactory.decodeStream(input);
System.out.println("the bitmap is +bitmap[i]);

在logcat的错误:

Error in Logcat:

03-29 15:01:50.044: DEBUG/skia(238): --- SkImageDecoder::Factory returned null
the bitmap is null

这怎么解决?

How can this problem be solved?

推荐答案

检查URL确实是一个形象,而不是一个HTML文件。有这个令人沮丧的问题,然后我意识到我曾试图下载一个位图在一个WiFi热点......这要求我先登陆。你保存的图像可能显示,当您需要登录!HTML文件

Check that the URL is indeed an image, and not a HTML file. Had this frustrating issue and then I realized I had attempted to download a bitmap over a WiFi hotspot... which required me to log in first. Your saved image is probably the HTML file that shows when you need to log in!

在保存前,检查前几个字节,以确保它是一个PNG,XML,JPG,等等。

Before saving it, check the first few bytes to make sure it is a PNG, XML, JPG, whatever.

这篇关于如何解决SkImageDe codeR ::厂返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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