2

I was trying to get HTML content from a website and displaying it in a Text View. But i am getting an error:

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

This is the 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)

This is my code used for

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);

When I Toast the file 'path' , I am getting correct URL.

Aduait Pokhriyal
  • 1,529
  • 14
  • 30
Arun
  • 364
  • 2
  • 7
  • 19
  • Cross check your http `URL` – M D Mar 10 '14 at 11:52
  • I already checked it. I Toasted the String 'path'and I am getting current URL. But in log cat the URL is "/http:/www.mobileappscentre.co.uk/healthapp/wp-content/uploads/2013/11/tmt-instability-226x300.jpg" – Arun Mar 10 '14 at 11:56
  • Not the path , check the URL you are using in browser , is it available or not. – Aduait Pokhriyal Mar 10 '14 at 11:57
  • or kindly look at this post: [/html-imagegetter-textview](http://stackoverflow.com/questions/16179285/html-imagegetter-textview?rq=1) – M D Mar 10 '14 at 11:58
  • '/http:/www.mobileappscentre.co.uk/healthapp/wp-content/uploads/2013/11/tmt-inst‌​ability-226x300.jpg' this is the log cat URL. It is not found. But the URL i got when i toast is "http://www.mobileappscentre.co.uk/healthapp/wp-content/uploads/2013/11/tmt-inst‌​ability-226x300.jpg" that url has an image – Arun Mar 10 '14 at 12:01
  • Thanks Simple Plan, Let me try that solution – Arun Mar 10 '14 at 12:02
  • @Simple plan, that link Helped me, Thanks – Arun Mar 11 '14 at 04:43
  • @Arun now, your issue solved.that was great. – M D Mar 11 '14 at 04:50

0 Answers0