problem with Checkboxes inside ListView using BaseAdapter

by droid_gal » Sat, 02 Apr 2011 10:47:13 GMT


Sponsored Links
 Dear all,

I have a problem with my adapter that extends BaseAdapter
That is to inflate the listview's rows with a text view and a
checkbox.
The size of the listview is of 20 after binding and have to scroll to
see all the items.
When I checked a checkbox, says it's from the 1st row, it's also
checked the 11th checkbox automatically.
When I unchecked the 1st one, then the 11th also is unchecked.
I tried for different rows and I found out that it automatically
checks/unchecks the checkbox with difference of 10 from the checked/
unchecked one.

This is the layout xml file content for individual row:
<FrameLayout
  xmlns:android=" http://schemas.android.com/apk/res/android" ;
  android:layout_width="match_parent"
  android:layout_height="match_parent"

  >
  <TextView android:id="@+id/tvRow"
        android:textSize="16sp"
        android:textStyle="bold"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:gravity="center_vertical|center_horizontal"/>

        <CheckBox android:id="@+id/chkRow"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_gravity="right"
                android:background="@null"
        />
  </FrameLayout>

Thanks in advance for any input to this issue.

-- 



Re: problem with Checkboxes inside ListView using BaseAdapter

by Justin Anderson » Sat, 02 Apr 2011 13:33:29 GMT


 You are suffering from a case of view recycling.  You have to keep track of
the checked views on your own and set the checked state of the checkbox in
your adapter's getView() method.

If you search Google for Android View Recycling you should be able to find
several examples of how to do this.

Thanks,
Justin Anderson
MagouyaWare Developer
 http://sites.google.com/site/magouyaware 






-- 


Sponsored Links


Re: problem with Checkboxes inside ListView using BaseAdapter

by Mary Aone » Thu, 12 May 2011 08:59:30 GMT


 @Justin Anderson: Thanks. I 'd already solved the issue and it was the same
way you mentioned.





-- 



Other Threads

1. Paging yopie ratjoen

Maaap mod numpang jalum mau pejing om yopie, tulung liatin DM yak


Sent from my BlackBerry smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!

-- 
"Indonesian Android Community [id-android]" 

2. Ipv6 support - dalvik/vm/Properties.c

Hi All

In Eclair code base under dalvik/vm/Properties.c I am seeing
java.net.preferIPv6Addresses set to true.
With this If i run CTS test cases all related to socket address and
local address are failing.

Is this means that phone is not supporting ipv6?

If i make java.net.preferIPv4Stack to true all CTS cases are getting
passed.

My understanding from the above is if we want to support IPv6 then we
have to make it to true. In Donut this flag is not set and also
java.net.preferIPv4Stack.

I am not getting in Donut code where one of these flags are set and
when?

Please redirect me if this is not correct group to ask this question.

Thanks
Gururaja B O

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Tab reload data

4. How to check the version of my application on the android market programatically

5. Why Android is using alsa device in block mode?

6. Android:Image Not Displayed In WebView

7. Experienced Developer needed ASAP in the Paris Area