When the user clicks on the list row, you are passed a position as a parameter. This is an index into your Adapter's data model, and you use it to find the details of the particular row that was clicked upon. Here is a sample project demonstrating this:
https://github.com/commonsguy/cw-android/tree/master/Selection/List Also, please consider using the android.util.Log class, not System.out. On Sat, Dec 3, 2011 at 7:50 AM, Kiran Kumar Kendole <[email protected]> wrote: > Hey All, > > I created a List view . Items for this list I am fetching from Database and > put it in an arryalist. My XML is > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > > > <CheckBox android:id="@+id/checkbox" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text=" " > /> > <TextView > android:id="@+id/label" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="@+id/label" > android:textSize="20dip" > android:clickable="true" > android:onClick="showPopUp"/> > </LinearLayout> > > I am just trying to get the Item which is selected by the user. For this I > added clickbility for TextView and onClick calling a function > showPopUp . > > public void showPopUp(View button){ > TextView selectedView = (TextView)findViewById(R.id.label); > String selectedData = selectedView.getText().toString(); > System.out.println("========="+selectedData); > } > > On click any item , the sysout is showing first item value. Can anybody help > me. > > I want to do .... when click on a item.. based on that item.. i will fetch > the record (row) from the table and show in a alert dialogue builder. > > Thanks, > KIRANKUMARKENDOLE > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.7 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

