Hi all,

I'm kind of to android development. I'm creating an app containing
several activities, and one of them is an ListActivity. Each row
contains a ImageView (thumbnail) and two TextViews.

When the ListActivity is loaded everything looks fine, but when I
start to scroll it scrolls very slow. I've read some posts and threads
about this, and from what I understand the problem could be that the
UI thread is getting locked up when the getView() method is called in
my adapter class (extends ArrayAdapter).

The getView() is doing some, in this case, heavy processes. It looks
like this

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
        View v = convertView;
        if (v == null) {
        LayoutInflater vi =
(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.row_item, null);
        }
        Item i = items.get(position);
        if (i != null) {
                name = (TextView) v.findViewById(R.id.item_name);
                timeLeft = (TextView) v.findViewById(R.id.item_time_left);
                thumb = (ImageView) v.findViewById(R.id.item_thumb);

                name.setText(i.getShortDescription());
                timeLeft.setText(Utils.getTimeLeft(i.getEndDate()));
                try {
                        
thumb.setImageBitmap(Utils.getBitmap(i.getThumbNailLink()));
                } catch(Exception e){};
        }
        return v;
}

I've tried to speed up the getView() by using an DrawableManager class
that I found in this thread
http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview...
This gets the image (from url) in a seperate thread and handle some
simple cache for the images (HashMap). If I only add the image to the
row in the ListView it's pretty fast, especially due to the caching
done i DrawableManager. But when I fill the two TextViews with text it
still gets very slow. So that didn't help me out. (I also tried to
cache and handle the TextField values in the DrawableManager, but that
didn't help either.)

Do you guys have a good solution for me?

Thanks in advance

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to