Android: duplicate items in ListVew. Maybe getView() called too many times?

Posted by gonzobrains on Stack Overflow See other posts from Stack Overflow or by gonzobrains
Published on 2011-01-13T09:51:34Z Indexed on 2011/01/13 9:53 UTC
Read the original article Hit count: 292

Filed under:
|
|

Hi,

I am trying to create a simple program which displays a "shopping cart" list of items, along with a few buttons below it to manage the cart.

The biggest problem is that items are getting duplicate entries in the list view. That is, for every item I want to enter I see it appear two times in the list view. What's the problem? Also, the scrollable area of my cart is not big enough. How do I set it so that it is bigger but I can still see my buttons? Perhaps I should put the buttons above the cart?

Here is my shopping cart's layout XML:

Here is the layout for individual row items:

  <LinearLayout
  android:orientation="vertical"
  android:layout_width="0dip"
  android:layout_weight="1"
  android:layout_height="fill_parent">

  <TextView
  android:id="@+id/BookTitle"

android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:singleLine="true" android:gravity="center_vertical" />

  <TextView
  android:id="@+id/BookPrice"

android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:singleLine="true" android:ellipsize="marquee" />

Thanks, gb

© Stack Overflow or respective owner

Related posts about android

Related posts about listview