There is a great post on Android Developers blog about this, covering background threads, memory management, lazy loading... the works... with detailed sample code.
In short, it's great. Look it up. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 25.11.2010 2:13 пользователь "Doug" <[email protected]> написал: > On Nov 22, 11:31 pm, Kumar Bibek <[email protected]> wrote: >> The answer to both your questions is Yes. >> >> http://developer.android.com/reference/android/widget/ImageView.html#... > > setImageUri here is for android resources, not http urls. It won't > work. > > If the task is to populate an ImageView within a ListView item, it > actually takes a lot of work. You'll need to implement a custom > Adapter (please do yourself a favor and don't try to "force" the image > in a simple adapter). Your adapter will need to build the list item > view including the embedded ImageView. You will need to write or have > some utility to fetch the remote image and convert it to a bitmap so > it can populate the ImageView. In order not to block the UI while > showing and scrolling the list, the http fetch needs to be > asynchronous and refresh the adapter when the bitmap is ready OR you > will need to fetch and cache all of them ahead of time before showing > the ListView. You will also need to decide what to show if one or all > of images can't be fetched, and how long you're willing to wait for a > fetch to complete, and how to cancel any fetches if the activity needs > to finish before they're done. > > You may have gotten the sense that there is a fair amount of > engineering effort to accomplish something that seems like it should > be simple. Welcome to mobile application development. :-) > > Doug > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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

