Questions tagged [convertview]

ConvertView represents one of the parameters of the `getView` method of various Android adapters, often used to improve the performance of that adapter.

The convertView is a parameter in the getView method of all Android adapters. This convertView represents a recycled row view(if it is not null) which should always be used in the getView method to avoid the costly creation of objects every time the adapter is required to supply a row view from its getView method. A typical use pattern of the convertView in the getView method is:

  • check if the convertView is null.
  • if the convertView is null then the getView method must build the entire row view as there is no recycled view available.
  • if the convertView is not null then the getView method is supplying a recycled view on which the only needed actions are to setup the correct data/information.

More information about the convertView importance and use can be found in the Google I/O video about Android performance.

83 questions
0
votes
1 answer

Android ArrayAdapter increasing cached views to improve performance

So I have a listview with an image and some text hooked by a custom array adapter. The problem I am facing is that the image is still loading a little bit too slow for my liking. I've watched the google tech talk and attempted to optimize my list by…
kennzors
  • 15
  • 8
0
votes
2 answers

Android ListView with Section separators and complex list items. Scrolling weirdly and drawing weirdly

This question has been edited for the second time: To view the original question, please Scroll down to where it says "ORIGINAL QUESTION" - for any edits after that - Please scroll down to an "EDIT #" section. EDIT TWO: This edit is in reponse to…
shecodesthings
  • 1,218
  • 2
  • 15
  • 33
0
votes
0 answers

Use convertview for different layout but no change the xml value

How to match string on different layout of page indicator like fist.xml ,second.xml and third.xml on button click .I am using convertview but doesnot bold the value of each layout xml. mInflater = (LayoutInflater)…
VKSingh
  • 452
  • 6
  • 17
-1
votes
1 answer

Android: Should I use a ListView? (case: list elements with partially unknown structure)

Assumptions about the list (updated): It will not contain more than 10 list elements (the list elements are defined by the xml layout below). The height of every element is unknown, because the list element contain a LinearLayout that can have up…
-1
votes
1 answer

Are convertViews being reused in a ListView?

I am using this code to layout my ListView, using a different layout based on some data: @Override public View getView(int i, View convertView, ViewGroup viewGroup) { ViewHolder viewHolder; MyInfo myInfo = getItem(i); String label =…
Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195
-1
votes
1 answer

Why view return null in android

I have 3 activity that display listview and it has an image to display icon and textview to display data. I want to make an adapter that can use general for my listview on these activity. But when I run my app, the logcat show me null pointer…
Xiao King
  • 369
  • 1
  • 13
-1
votes
2 answers

Using convert view pattern when there is changes in view

I am using convert view pattern in my custom array adapter class for list view efficiency. However i am facing problem that , I have an ImageView inside row template whose visibility i decide on a certain conditions inside getView method. When…
Sumit
  • 152
  • 2
  • 11
-3
votes
2 answers

Explain individual role of convertView and View Holder Pattern in ListView

Can anyone explain the individual role of convertView and View Holder Pattern in ListView, and how they increased the efficiency of listview? private class PersonsAdapter extends ArrayAdapter { @Override public View getView(int…
Maaz Aftab
  • 238
  • 2
  • 9
1 2 3 4 5
6