3

I am receiving images from a URL and they display on the emulator but when I use a device the default image is shown. Im not totally sure which part of the code you require so Ill add more on request:

pubImage = extras.getString("pubImage");

ImageView ivimage = (ImageView) findViewById(R.id.image);
try{
            ivimage.setImageDrawable(grabImageDrawableFromUrl(pubImage));
            Log.d(TAG, pubImage);   

        }catch(Exception e){
            e.printStackTrace();
        }
John Peet
  • 55
  • 6

3 Answers3

2

I use Prime for all of my image loading in Android. If you were using it then you would not have to worry about issues like this.

HandlerExploit
  • 8,131
  • 4
  • 31
  • 50
  • Nice Self Promotion :-).. tried using it now.. But find the image a lot more scaled down than needed.Is there a way to give out required height, width in the API.. – Rasmus Jul 21 '12 at 20:31
  • If your using the RemoteImageView then make sure to set it to whatever size you require, outside of that I have never seen any issues whatsoever. – HandlerExploit Jul 21 '12 at 22:16
  • Thanks, +1 for the package.Looks good but just got an out of memory error. Let me try to work on that – Rasmus Jul 22 '12 at 05:11
2

try this...

InputStream is = (InputStream) this.fetch(url);
Drawable d = Drawable.createFromStream(is, "src");
ivimage.setImageDrawable(drawable);

if you still not get solution then use Universal Image Loader

MAC
  • 15,799
  • 8
  • 54
  • 95
0

Look at the answer to this question, it seems as if you might be missing a few details, but perhaps you should paste grabImageDrawableFromUrl() either way.

Community
  • 1
  • 1
Tyler
  • 19,113
  • 19
  • 94
  • 151