On Apr 2, 9:04 pm, xingye <[EMAIL PROTECTED]> wrote:
> My code
>
>                         ImageView iv =
> (ImageView)convertView.findViewById(R.id.image);
> //                      iv.setImageResource(R.drawable.badge);
>                         Uri uri = Uri.parse("http://www.yexing.org/
> image.axd?
> picture=browse.png");
>
> //                      iv.setImageURI(uri);
> //                      Drawable drawable =
> Drawable.createFromPath(uri.getPath());
>                         try {
>                                 URL url = new 
> URL("http://www.yexing.org/image.axd?
> picture=browse.png");
>                                 InputStream is = url.openStream();
>                                 Drawable drawable =
> Drawable.createFromStream(is, "none");
>                                 iv.setImageDrawable(drawable);
>                         } catch(Exception e) {
>                                 Log.e(LOG_TAG, "load image error! \n"
> + e.toString());
>                         }
>
> On 4月2日, 上午9时19分, David Given <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm trying to programmatically set the image on an ImageView. (Part of a
> > SimpleCursorAdapter binding function.) I'm finding that the image never
> > appears to show up.
>
> > While this behaviour appears if I call setImageURI(), I also see it if I
> > break things down as follows:
>
> > ImageView iv = (ImageView) view;
> > String path = getApplication().getFilesDir().getAbsolutePath();
> > InputStream is = new FileInputStream(path + "/icon.png");
> > Drawable icon = new BitmapDrawable(is);
> > Log.i("Fnord", "width="+icon.getIntrinsicWidth()+
> >      " height="+icon.getIntrinsicHeight());
> > iv.setImageDrawable(icon);
>
> > I'm getting sensible tracing, indicating that the image has loaded
> > correctly, and iv.setImageDrawable() appears to succeed --- but nothing
> > happens. The ImageView doesn't even change size.
>
> > Any suggestions?
>
> > --
> > David Given
> > [EMAIL PROTECTED] Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to