Hi, I've been doing some tests and apparently the problem is not in the drawable, but in the way I create the InputStream.
file_handle = new RandomAccessFile(payload.file(), "r"); file_handle.read(result); String output = new String(result); ImageView img = (ImageView) this.findViewById(R.id.DTNApps_DTNReceive_ImageView); byte[] bytes = output.getBytes(); InputStream in = new BufferedInputStream(new ByteArrayInputStream(bytes)); ........ Where am I doing something wrong?? Do I have to indicate any encoding string (output.getBytes("US-ASCII") or something?? On 7 oct, 12:55, Gorka <gork...@gmail.com> wrote: > Hi, > > I am trying to depict on the screen the image I receive from my > neighbour via a text message. I mean, the other node sends me a > message where an image is encode (I can read the PNG header, ...) and > now I want to show it on the screen, but it doesn't appear nothing. I > must be doing something wrong ¬¬. > > Here is my code: > > ImageView img = (ImageView) > this.findViewById(R.id.DTNApps_DTNReceive_ImageView); > > byte[] bytes = input.getBytes("US-ASCII"); > InputStream in = new BufferedInputStream(new > ByteArrayInputStream(bytes)); > > Drawable drw = Drawable.createFromStream(in, "src"); > img.setImageDrawable(drw); > > As I said, nothing appears on the screen. The img hsa a correct value > since I try > "img.setImageDrawable(getResources().getDrawable(R.drawable.sample_0));" > and shows the picture. > > Can anyone help me?? > > Bye and thanks for your time. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en