0

Please cope with me as im new to android and i have done a lot of searching on my own, about this, and im fed up not finding a proper way.

This is my custom listview template. rowbuttonlayout.xml.

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:textSize="19.6dp" >
    </TextView>

   <CheckBox
        android:id="@+id/check"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="3.6dp"
        android:layout_marginRight="9.6dp" >
    </CheckBox>

   <TextView
       android:id="@+id/result"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignBaseline="@+id/check"
       android:layout_alignBottom="@+id/check"
       android:layout_toLeftOf="@+id/check"
       android:text="@string/nothing" />

    </RelativeLayout> 

What i want is to create something like this in this pic without the header and footer.

http://www.vogella.com/articles/AndroidListView/images/xinteractive10.png.pagespeed.ic.V0cVgp99SN.png

As on my layout ill be having another textview just before the checkbox as well. Also ill be adding a dynamic button at the footer. Now i dont want the users to interact with my listview. Only the button should be clickable and when they click it i want to run some calculations and show them in the relevant "result" textview and to check the checkbox next to it to show that i have calculated it. Meaning i have to access each and every "result" textview and "check" checkbox in the code.

Please provide me some guidance for coding this app. Im fed up looking through very complex codes trying learn on my own. Many many thanks for your help. Shavinka

1 Answers1

0

Check out below links...

ListView + CheckBox =?

How to get checked items from android listview?

http://sunil-android.blogspot.in/2013/04/android-listview-checkbox-example.html

http://fundoocode.net/android-listview-checkbox-example-onitemclicklistener-and-onclicklistener/

http://www.mysamplecode.com/2012/07/android-listview-checkbox-example.html

Community
  • 1
  • 1
Hariharan
  • 24,741
  • 6
  • 50
  • 54
  • this is not what im looking for. rather a help with the coding. Declaring listview, adding items, setting adapter, accessing elements kind of thing – Shavinka Nilesh Sep 04 '13 at 15:47
  • yes. if you can. @Hari. my friend please check my question again. Im not looking for any user interaction rather i want to tick the checkboxes within the code. – Shavinka Nilesh Sep 04 '13 at 16:19
  • I checked them... but i couldnt find a way to set text to a textview in the listview via the code. Im talking about after initializing the listview, code that executes on the button. – Shavinka Nilesh Sep 05 '13 at 11:38