Questions tagged [convertview]

ConvertView represents one of the parameters of the `getView` method of various Android adapters, often used to improve the performance of the 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
2 answers

How do I apply layout changes to one individual ListView item without the adapter recycling the layout to other items?

I have a custom adapter for a ListView. On getView(), I attach an onTouchListener to the convertView. Upon touch of the item/convertView, I update the ViewHolder's RelativeLayout's LayoutParams to be shifted left and set a couple buttons revealed…
Taylor Kline
  • 703
  • 2
  • 8
  • 23
0
votes
1 answer

Refresh or relayout the new convertView like first time when listview call getView()

I have a listview that use a GestureDetector to handle swipe left. For each item, layout like below: [FrameLayout] [LinearLayout] hidden_menu [/LinearLayout] [LinearLayout] main_layout [/LinearLayout] [/FrameLayout] , it will handle…
NamNH
  • 1,580
  • 12
  • 32
0
votes
1 answer

SwipeListView stays in "swiped state" after deleting a row

I'm using SwipeListView library for my list. List adapter is using ViewHolder Pattern, everything is working fine. I set up swipe left and there's a back view under my list item view. On this back view I have a text view "Delete". After click,…
elhm
  • 135
  • 1
  • 10
0
votes
1 answer

How to make an Adapter to not return convertView?

I have an Adapter that extends ArrayAdapter. I give an ArrayList to the Adapter with, for example, 9 objects, and I want it to not show the fifth object in the ListView. Is there a way to do this? I tried with setting convertView = null before…
0
votes
2 answers

Android ListView item: stableIds and yet getting incorrect position

Unfortunately I really think I have to explain my situation a little bit extensively. I am writing an android app regarding the ancient Latin language: my goals are showing to users the entire conjugation of latin verbs, and giving them the right…
Massimo Baldrighi
  • 355
  • 2
  • 4
  • 15
0
votes
1 answer

Android ListView tries to reuse visible cell after setImageBitmap call with async downloaded bitmap

I have very strange behavior when ListView adapter provides into getView method the same convertViews even if all of them are visible: getView(); 0; holder: ViewHolder@4289bde8 getView(); 1; holder: ViewHolder@4289bde8 getView(); 4;…
goRGon
  • 4,104
  • 1
  • 41
  • 43
0
votes
1 answer

ListAdapter showing already shown item when scrolled

I'm pretty new to Android, and I'm currently having some problem in using custom list adapter. Basically, I want to make a list of question, with different type for each question (radio, checkbox, text, numeric). When the listview is generated, it…
alfa
  • 3
  • 1
0
votes
3 answers

Android convertView

i have used horizontal listview like this with Baseadapter. private class ListViewItemClickListener implements AdapterView.OnItemClickListener { @Override public void onItemClick(AdapterView parent, View view, int…
Moon Taejin
  • 321
  • 3
  • 9
  • 20
0
votes
1 answer

ImageView restore background color for recycled views

in my Android App I use an AlertBox for selecting icons. This is done with a custom Adapter. I have a class comming from ImageView which changes the backgrond color for the old selected icon. All works fine expect that I nees to reset the background…
0
votes
2 answers

Problems implementing ViewHolder, ObjectItem cannot be resolved to a type

Im implementing a ViewHolder. Im using this tut: Link And this is the code: @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; /* * The convertView argument is…
Npv23g
  • 726
  • 9
  • 32
0
votes
2 answers

Problems with ListView recycling

I'm having some problems with ListView and my custom adapter whereby the wrong position is obtained when an item is clicked. Basically, the name of the item in the adapter is sent to a different activity when the item is clicked, and it works fine…
stackUnderflow
  • 149
  • 2
  • 8
0
votes
0 answers

How to clear convertView

I have a row in a listview that I need to change its layout dynamically. In my array adapter I have the following (simplified) code @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null) { …
Neoh
  • 14,891
  • 12
  • 62
  • 78
0
votes
0 answers

Pre load convert view

I have three kind of layouts in my list. My problem is that only two kinds are showing, when the list is shown at the beginning. So when I scroll down, I have these two layouts ready to be converted and provide a smooth scroll but when the third…
roiberg
  • 12,799
  • 11
  • 54
  • 87
0
votes
1 answer

a few images of the listview is populating all listview-items when scrolling

I have had problems for a long time understanding different aspects of listviews. Here is one issue. I know a workaround but I want to understand why it happens. Its in the getView-method of a class that extends ArrayAdapter. I have several…
Björn Hallström
  • 3,503
  • 7
  • 33
  • 47
0
votes
0 answers

Adapter, convertView, GridView, Images sliding on top, browse outside the gridview

I have some throuble with getting my GridView working as it should. When I scrol some of the images are sliding much faster than other images (they will not stay in their row). Sometimes I am also able to scrol above the first line! If I skip to use…
Eric1101000101
  • 421
  • 6
  • 15