可以BitmapFactory.de codeFILE处理.ICO(Windows图标)文件?图标、文件、de、BitmapFactory

2023-09-04 10:49:31 作者:繁华落尽

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

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.

 
精彩推荐
图片推荐