无法解码流:java.io.FileNotFoundException Android

时间:2014-03-10 11:49:34

标签: android html image

我试图从网站获取HTML内容并在文本视图中显示它。但我得到一个错误:

"Unable to decode stream: java.io.FileNotFoundException"

这是logcat:

03-10 10:41:22.905: E/BitmapFactory(2994): Unable to decode stream: java.io.FileNotFoundException: /http:/www.mobileappscentre.co.uk/healthapp/wp-content/uploads/2013/11/tmt-instability-226x300.jpg: open failed: ENOENT (No such file or directory)

这是我用于

的代码
Spanned htmlSpan = Html.fromHtml(display, new ImageGetter() {           
    @Override
    public Drawable getDrawable(String source) {

      String path =  source;    

      Drawable bmp = Drawable.createFromPath(path);
      bmp.setBounds(0, 0, bmp.getIntrinsicWidth(), bmp.getIntrinsicHeight());

      Drawable bmp = null;
      return bmp;
    }
}, null);
blog.setText(htmlSpan);

当我向文件“路径”进行Toast时,我收到了正确的网址。

0 个答案:

没有答案