I see some problems here:
// Bind the data efficiently with the holder.
holder.titleText.setText(Html.fromHtml(((FeedMessage)Items.get
(position)).g etTitle()));
holder.descriptionText.setText(Html.fromHtml(((FeedMessage)Items.get
(positi on)).getDescription()));
Drawable d = null;
FeedMessage fm = (FeedMessage) Items.get(position);
if that Items.get(position) is costly, you're wasting it, above. How
about:
// Bind the data efficiently with the holder.
Drawable d = null;
FeedMessage fm = (FeedMessage) Items.get(position);
holder.titleText.setText(Html.fromHtml(fm.getTitle
()));
holder.descriptionText.setText(Html.fromHtml
(fm.getDescription()));
On Jan 6, 12:57 pm, Patrick Plaatje <[email protected]> wrote:
> Hi,
>
> i've used the holder method, but adding or omitting this didn;t give
> me an increase or decrease in performance, my getView method is below:
>
> @Override
> public View getView(int position, View convertView, ViewGroup parent)
> {
>
> // A ViewHolder keeps references to children views to avoid
> unneccessary calls
> // to findViewById() on each row.
> ViewHolder holder;
>
> holder = new ViewHolder();
>
> // When convertView is not null, we can reuse it directly,
> there is no need
> // to reinflate it. We only inflate a new View when the
> convertView supplied
> // by ListView is null.
> if (convertView == null){
> convertView = mInflater.inflate(R.layout.article_row,
> null);
>
> // Creates a ViewHolder and store references to the two
> children views
> // we want to bind data to.
> holder.titleText = (TextView)
> convertView.findViewById(R.id.article_title);
> holder.descriptionText = (TextView)
> convertView.findViewById(R.id.article_description);
> holder.icon = (ImageView)
> convertView.findViewById(R.id.article_thumb);
>
> convertView.setTag(holder);
> } else {
> // get holder back...much faster than inflate
> holder = (ViewHolder) convertView.getTag();
> }
>
> // Bind the data efficiently with the holder.
>
> holder.titleText.setText(Html.fromHtml(((FeedMessage)Items.get(position)).g
> etTitle()));
>
> holder.descriptionText.setText(Html.fromHtml(((FeedMessage)Items.get(positi
> on)).getDescription()));
>
> Drawable d = null;
> FeedMessage fm = (FeedMessage) Items.get(position);
>
> if(fm.getEnclosures().size() > 0){
> String urlString = fm.getEnclosures().get(0);
> dm.fetchDrawableOnThread(urlString, holder.icon);
> } else {
> d =
> _context.getResources().getDrawable(R.drawable.thumb_holder);
> holder.icon.setImageDrawable(d);
> }
> if(fm.getGuid() != null){
> convertView.setId(position);
> }
>
> return convertView;
> }
>
> static class ViewHolder {
> TextView descriptionText;
> TextView titleText;
> ImageView icon;
> }
>
> regards,
>
> Patrick
>
> 2010/1/6 Vince <[email protected]>:
>
>
>
>
>
> > What does your getView code look like. Are re-inflating your row view
> > every time it's called, are there multiple views for the rows etc?
>
> > Vince
>
> > On Jan 6, 10:18 am, Patrick Plaatje <[email protected]> wrote:
> >> Hi all,
>
> >> for my app i'm using a listview to display rss news articles. All goes
> >> well, and the implementation is almost done. But when using my app,
> >> i'm not really satisfied with the "smoothness" and user experience of
> >> it. The main problem is that when i scroll through the listview, which
> >> contains an image for each row in the listview, the scrolling isn;t
> >> smooth, it executes the getview override every time. I already threw
> >> out the "holder startegy", as it slowed the scrolling...
>
> >> any thoughts?
>
> >> Thanx,
>
> >> Patrick
>
> > --
> > 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
>
> --
> Met vriendelijke groet,
>
> Patrick Plaatje
>
> NDC|VBK de uitgevers
> Sixmastraat 32, 8915 PA Leeuwarden
> Postbus 394, 8901 BD Leeuwarden
> T (058) - 284 5044
> M (06) - 158 966 34
--
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