Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6549345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:04:54+00:00 2026-05-25T12:04:54+00:00

Good day, i was having a little trouble with the following code below and

  • 0

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.

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

solution link here

my code below:

    public void onItemClick(AdapterView<?> 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);
 }

so from his solution, if i change this to this

String info = ((TextView) v.findViewById(R.id.search_device_id)).getText().toString();

it solves my ClassCastException problem.

Now please can someone kindly explain to me or point me to the right direction, what he meant by in the answer “You receive the whole LinearLayout as the parameter v. You should try v.findViewById() and then use this textview.” 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:04:54+00:00Added an answer on May 25, 2026 at 12:04 pm

    The View v that you get is the entire Layout for the object that has the TextView (and probably other views) inside it.

    It is not the TextView itself, you have to find the TextView that is inside of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day, I'm having a little trouble with calculating number of days from now
Good day, I'm having a ton of trouble with the following php code, the
Good Day, I'm new to this Youtube GData api and i'm having trouble with
Good day, i am having troubles with the following image below. As you can
Good day. I am having the following code snippet in init.php. <?php include_once(config.php); include_once(__SITE_PATH
Good morning, I am having trouble with the following code <html> <head> <title>highlight date</title>
Good day everybody! Having the following code: template<typename T, typename OutStream = std::ostream> struct
Good day, I am having a little bit of a problem. I want to
Good day all, I am having some trouble with image permissions. I am loading
Good day. Having read about Model 2 architecture I got confused about some points.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.