xml - Android custom ArrayAdapter efficiency -


i have implemented custom adapter class extends arrayadapter. have tried make efficient possible making use of viewholder approach, since learn, xml inflation performed in adapter's getview(...) method involved process should done few times possible.

with in mind, here scenario:

i have listview 6 possible items can displayed in list. 6 items alike, differences have different icons, different text , might have additional image/icon displayed in item itself.

every time adapter's getview(...) method called therefore change icons, text , make elements visible/invisible based on item dealing with,but inflate single xml file - , done once.

my question following:

is current approach less efficient making 6 separate xml item layouts, inflating each of these 6 items once, , recycling these views each item. mean setvisibility(...), setimageresource(...) etc. methods no longer need called each time getview(...) called, inflating xml once each item type (6 inflations rather one).

my gut feeling tells me efficiency improvement gained inflating 1 xml layout, countered setimageresource(...) calls making in getview(...). right?

i know specific question, feel answers me understand custom adapters in android little bit better , appreciate feedback.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -