ClassCastException Explanation
<p>Good day, i was having a little trouble with the following code below and i got a solution from a ticked answer in this link. I would like to know why.</p>

<p>Note: i had a similar type of layout as in the question, but with one TextView only.</p>

<p><a href="http://stackoverflow.com/questions/6054773/classcastexception-in-my-application">solution link here</a></p>

<p>my code below:</p>

<pre><code>    public void onItemClick(AdapterView&lt;?&gt; av, View v, int position, long id) {
        blueadapter.cancelDiscovery();

    String info = ((TextView) v).getText().toString(); //classcastException here
    String Bluetooth_address = info.substring(info.length()-17);
 }
</code></pre>

<p>so from his solution, if i change this to this</p>

<pre><code>String info = ((TextView) v.findViewById(R.id.search_device_id)).getText().toString();
</code></pre>

<p>it solves my ClassCastException problem.</p>

<p>Now please can someone kindly explain to me or point me to the right direction, what he meant by in the answer <strong>"You receive the whole LinearLayout as the parameter v. You should try v.findViewById() and then use this textview."</strong>  its nice it solves my problem, but i would like to understand why i had to do that?.. i have dealt with ListViews before, but i have not come across this, so its kind of strange for me. Thank you.</p>
