The position parameter to the onListItemClick() method is "the row number", insofar as such a concept exists.
On Thu, Jan 6, 2011 at 7:51 AM, Amit Mangal <forum.amit.man...@gmail.com>wrote: > thank you i am trying to get row number using this code. > > > On Thu, Jan 6, 2011 at 4:44 AM, Kapil Lokhande <kpl.lokha...@gmail.com>wrote: > >> here is the snippet >> >> import android.app.ListActivity; >> import android.os.Bundle; >> >> >> import android.widget.ArrayAdapter; >> >> public class SimpleListView extends ListActivity >> { >> /** Called when the activity is first created. */ >> >> @Override >> public void onCreate(Bundle savedInstanceState) >> { >> super.onCreate(savedInstanceState); >> setListAdapter(new ArrayAdapter(this, >> android.R.layout.simple_list_item_1, WORLDCUP2010)); >> >> >> >> getListView().setTextFilterEnabled(true); >> } >> >> static final String[] WORLDCUP2010 = new String[] { >> "Algeria", "Argentina", "Australia", >> "Brazil", "Cote d'Ivoire", "Cameroon", >> >> >> >> "Chile", "Costa Rica", "Denmark", >> "England", "France", "Germany", >> "Ghana", "Greece", "Honduras", >> "Italy", "Japan", "Netherlands", >> >> >> >> "New Zealand", "Nigeria", "North Korea", >> "Paraguay", "Portugal","Serbia", >> "Slovakia", "Slovenia", "South Africa", >> >> >> >> "South Korea", "Spain", "Switzerland", >> "United States", "Uruguay" }; >> } >> public void onListItemClick(ListView parent, View v, >> int position,long id) { >> >> >> >> selection.setText(WORLDCUP2010[position]); >> } >> >> } >> >> -- >> Thanks & Regards, >> Kapil Lokhande | Dexter Advisory Pvt. Ltd. <http://dexterltd.com/> | >> Android Developer >> [image: dexterlogo.jpg] >> >> >> On Thu, Jan 6, 2011 at 6:05 PM, Amit Mangal >> <forum.amit.man...@gmail.com>wrote: >> >>> which function i need to call ? >>> do you have some code snippet i am new to android and don know any thing. >>> >>> thank you >>> >>> >>> On Thu, Jan 6, 2011 at 5:58 PM, Kapil Lokhande >>> <kpl.lokha...@gmail.com>wrote: >>> >>>> Hi Amit, >>>> >>>> you have to override onListItemClick event in your activity extending >>>> listactivity. >>>> in that event you wull get position or row number of list item. >>>> -- >>>> Thanks & Regards, >>>> Kapil Lokhande | Dexter Advisory Pvt. Ltd. <http://dexterltd.com/> | >>>> Android Developer >>>> [image: dexterlogo.jpg] >>>> >>>> >>>> On Thu, Jan 6, 2011 at 5:04 PM, Amit Mangal < >>>> forum.amit.man...@gmail.com> wrote: >>>> >>>>> Hi Any one, >>>>> Is there any way to get row number in list view in which i clicked ? >>>>> suppose that if i clicked on row 5 how can i get which number of roe i >>>>> clicked ? >>>>> >>>>> thank you >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Android Developers" group. >>>>> To post to this group, send email to >>>>> android-developers@googlegroups.com >>>>> To unsubscribe from this group, send email to >>>>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/android-developers?hl=en >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To post to this group, send email to >>>> android-developers@googlegroups.com >>>> To unsubscribe from this group, send email to >>>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >>>> For more options, visit this group at >>>> http://groups.google.com/group/android-developers?hl=en >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@googlegroups.com >>> To unsubscribe from this group, send email to >>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >>> For more options, visit this group at >>> http://groups.google.com/group/android-developers?hl=en >>> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > 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 Android 2.3 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en