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. Ways To Monetize Free Android Application

Hi everyone,

sadly i can't sell apps to the android market..(yet)
till then..
how can i make money from free apps?can you share info on ad-supported
model?
is the use of landing page/links to websites allowed?

Thank you




--~--~---------~--~----~------------~-------~--~----~

2. Anti-SMSishing discussio

Hi,

As an academic project, I tackle the problem of SMSishing. SMSishing
can be defined in the same way as a phishing except that the
fraudulent link is sent by SMS.

The goal of the project is to create an awareness about SMSishing.
Many approaches might have been used. I'm working with the Google Safe
Browsing API in order to download on the mobile phone the list of the
(hashed) fraudulent addresses. Then I extract the http links in the
SMS inbox to compare them with the database created on the phone.

There is some disadvantages doing like that :
- we need an internet connection
- the list provided is LONG so it takes time to write the database and
make comparaisons

Other methods to fight SMSishing would be :
- the mobile operator checks the validity of each SMS before sending
it to its destination
- a Google Safe Browsing API which allow to send the address we want
to check and make the test online (it avoids heavy computations)
- the security level is implemented inside the mobile browser and not
in the SMS/MMS application

The code and more details about my project can be found here :
http://code.google.com/p/anti-smsishing/

Other SMSishing related topic is Vishing : a fraudulent SMS asks you
to call a number you believe in (by example your bank) and most of the
time the called number will be an automatic voice responder asking you
personal informations (such as credit card number).
Both problems might be approach in the same way because we could store
a database of fraudulent number.

What do you think about these problems ? What would be the best
solution ? The most realistic implementation ? Should this problem be
handled by operators ? By the browser ? By the SMS application ?

Deniz.

3. People uploading our applications on Android Market without our agreement

4. AutoCompleteTextView and Theme.Light

5. vold or mountd

6. error while running simple SOAP application

7. How to track Android PIM changes?