Currently I'm successfully loading and displaying an image from a
webserver using the code below.
URL imgURL = new URL("http://www.xxx.com/myimage.png");
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
bm= BitmapFactory.decodeStream(bis);
bis.close();
is.close();
canvas.drawBitmap(bm, 0, 0, null);
What I want to do is load it from a resource. I've put myimage.png
into res/drawable and referenced the bitmap as follows :-
Bitmap bm = BitmapFactory.decodeResource(getResources(),
R.drawable.myimage);
However when I try to display it with canvas.drawBitmap(bm, 0, 0,
null); I get a Force Close.
What am I missing?
Thanks,
Simon.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en