0

I have implemented my custom Gallery using custom views instead of pictures.

Reference was http://www.programmingmobile.com/2011/08/android-tutorial-gallery-view-without.html

However now that I have about 8 custom views, containing complex layouts with lots of texts.

Problem is that the performance is very poor, I cache the views but scrolling is not smooth. With newer devices and tablets it's ok, but is there some hints how to add performance for older devices? I considered making views bitmaps, but they have a lot pressed/not pressed drawables + the text content changes quite frequently.

Simply my adapters getView is like this, almost all the time it returns cached view, but scrolling is not smooth, might me rendering issue of the views?

@Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        View cachedView = cachedViews.get(position);
        if (cachedView  != null) {
            return cachedView;
        }
    // Else inflate view etc.
    }
Niko
  • 8,093
  • 5
  • 49
  • 85
  • Can you post some code? I would suggest using convertView and a ViewHolder. It improves performance drastically. – Slickelito Jul 25 '12 at 07:03
  • You shouldn't try and cache the `View`s yourself, since the `ListView` recycles the `View`s of the list items automatically. If you want to improce performance, you should try to implement the `ViewHolder` model in your adapter. – Adam Monos Jul 25 '12 at 07:39
  • Yes, but this is Gallery, there is a known bug that its unable to recycle views, convertView is always null for me. – Niko Jul 25 '12 at 08:14

1 Answers1

0

Most likely the implementation of all layouts are just too complicated to run on older device without hardware acceleration and the fact that Gallery is supposed to be used with images, so there's not much to do here.

Niko
  • 8,093
  • 5
  • 49
  • 85