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,
 [email protected]


----------------------------------------

On Wed, Mar 28, 2012 at 10:20 PM, Justin Anderson <[email protected]>wrote:

> 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 <[email protected]>wrote:
>
>> 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 [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
>>
>
>  --
> 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

-- 
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

Reply via email to