可以BitmapFactory.de codeFILE处理.ICO(Windows图标)文件? [英] Can BitmapFactory.decodeFile handle .ICO (Windows icons) files?

查看:68
本文介绍了可以BitmapFactory.de codeFILE处理.ICO(Windows图标)文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的机器人。试图显示图标(又名快捷方式图标)或网页。

I am working on Android. Trying to display the "favicon" (aka "shortcut icon") or web pages.

所以,我已经有code得到来自任何网站的这个图标的网址,并下载到我的机器人。

So I already have the code to get the URL of this icon from any website, and download it onto my Android.

现在我想做一个位图出来,但总是得到null作为结果。

Now I am trying to make a Bitmap out of it, but always get null as a result.

在code:

String src = String.format("file:///data/data/com.intuitiveui.android/files/%s",prefName);
// prefName is "facebook.ico", and I do see tht file in my DDMS file browser. It's
// a valid icon file.

Bitmap res = BitmapFactory.decodeFile(src);
// This returns null

TIA

推荐答案

下面是的支持的Andr​​oid的媒体格式。 ICO不在其中。你也许可以找到一个基于Java的ICO德codeR,虽然。

Here is a list of the supported Android media formats. ICO is not among them. You might be able to find a Java-based ICO decoder, though.

这篇关于可以BitmapFactory.de codeFILE处理.ICO(Windows图标)文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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