Re: [android-developers] How to get the TextView values in ListView
Hi, If you want to access textview values from ListView, then you should use this code: public void onItemClick(AdapterView? arg0,View arg1,int position,long id) { TextView tv=(TextView) arg1.findViewById(R.id.videoId); String value=tv.getText().toString(); } Thanks Regards, M.Adiga, eesha...@gmail.com On Wed, Mar 28, 2012 at 10:20 PM, Justin Anderson magouyaw...@gmail.comwrote: String[] data; public void onItemClick(AdapterView? arg0, View arg1, int position, long id) { String temp= data[position]; TextView tv = (TextView)findViewById(R.id. videoId); tv.setText(temp); } This is not correct... He is not wanting to SET the text of the text view. He is wanting to GET the text from the text view. Also, you can't do findViewById in here because every list view row has the same id. You are going to get the first one every time doing this. i want to extract the textview values of that corresponding row. No you don't... The textviews in a list view are intended for display purposes only. They are intended to be a user display of the back-end data that you have, meaning your adapter How to get these values..??? What you need to do is access the DATA in your adapter at the given position... So there are a couple ways to get this data... If you have a refrence to your adapter, you could do something like this: String value = (String)_adapter.getItem(position); Or, if you have direct access to your data structure, say, an array of strings, you could do something like this: String value = stringVals[position]; Hope that helps... Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Mar 27, 2012 at 10:07 PM, BNReddy narayanareddy...@gmail.comwrote: String[] data; public void onItemClick(AdapterView? arg0, View arg1, int position, long id) { String temp= data[position]; TextView tv = (TextView)findViewById(R.id.videoId); tv.setText(temp); } -- Regards, Narayanareddy.B 9032478372 -- 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 -- 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 -- 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
Re: [android-developers] How to get the TextView values in ListView
String[] data; public void onItemClick(AdapterView? arg0, View arg1, int position, long id) { String temp= data[position]; TextView tv = (TextView)findViewById(R.id. videoId); tv.setText(temp); } This is not correct... He is not wanting to SET the text of the text view. He is wanting to GET the text from the text view. Also, you can't do findViewById in here because every list view row has the same id. You are going to get the first one every time doing this. i want to extract the textview values of that corresponding row. No you don't... The textviews in a list view are intended for display purposes only. They are intended to be a user display of the back-end data that you have, meaning your adapter How to get these values..??? What you need to do is access the DATA in your adapter at the given position... So there are a couple ways to get this data... If you have a refrence to your adapter, you could do something like this: String value = (String)_adapter.getItem(position); Or, if you have direct access to your data structure, say, an array of strings, you could do something like this: String value = stringVals[position]; Hope that helps... Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Mar 27, 2012 at 10:07 PM, BNReddy narayanareddy...@gmail.comwrote: String[] data; public void onItemClick(AdapterView? arg0, View arg1, int position, long id) { String temp= data[position]; TextView tv = (TextView)findViewById(R.id.videoId); tv.setText(temp); } -- Regards, Narayanareddy.B 9032478372 -- 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 -- 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
[android-developers] How to get the TextView values in ListView
Hi, I am using ListView CustomAdapter and i had placed the values in ListView. When i am clicking particular row in listview, i want to extract the textview values of that corresponding row. How to get these values..??? Plz Help me.. I am using these code public void onItemClick(AdapterView? arg0, View arg1, int position, long id) { Toast.makeText(getBaseContext(), List is clicking...!--+position, Toast.LENGTH_LONG).show(); TextView tv = (TextView)findViewById(R.id.videoId); String genus = tv.getText().toString(); } This will returns first value of the ListView.. i.e first row value Help me.. -- 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
Re: [android-developers] How to get the TextView values in ListView
String[] data; public void onItemClick(AdapterView? arg0, View arg1, int position, long id) { String temp= data[position]; TextView tv = (TextView)findViewById(R.id.videoId); tv.setText(temp); } -- Regards, Narayanareddy.B 9032478372 -- 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