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 8144159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:17:54+00:00 2026-06-06T13:17:54+00:00

I have a custom adapter for my ListView which has multiple TextViews. I want

  • 0

I have a custom adapter for my ListView which has multiple TextViews. I want to set an onItemClickListener to my ListView and extract text out of the TextViews. I tried using this:

String s =(String) ((TextView) mListView.findViewById(R.id.myNr)).getText(); 

but as expected by default it always returns the values from the first list item! (I guess because it doesn’t specify the item id from the list)

I also tried this:

String s =  (((TextView) mListView.getItemAtPosition(myItemInt)).
                          findViewById(R.id.myNr)).toString();

didn’t work! Any suggestions?

This is implemented under the following function:

mListView.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> myAdapter, View myView, 
                        int myItemInt, long mylng) {

             // String s statements

} 

EDIT:

Here’s the full code:

 mListView_myentries.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> myAdapter, View myView, 
                        int myItemInt, long mylng) {

                    String workRequestSelected = (String) ((TextView) mListView_myentries.findViewById(R.id.work_request)).getText();
                    String activitySelected = (String) ((TextView) mListView_myentries.findViewById(R.id.activity)).getText();
                    String statusSelected = (String) ((TextView) mListView_myentries.findViewById(R.id.status)).getText();
                    String workRequestDescSelected = (String) ((TextView) mListView_myentries.findViewById(R.id.desc)).getText();
                    String actualHoursString = (String) ((TextView) mListView_myentries.findViewById(R.id.actual_hours)).getText();

}
  • 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-06-06T13:17:56+00:00Added an answer on June 6, 2026 at 1:17 pm

    Try the below code

    mListView.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> myAdapter, View myView,int myItemInt, long mylng) {
                 String s =(String) ((TextView) myView.findViewById(R.id.myNr)).getText();
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView with custom adapter which is populated from local sqlite database.
I have a custom ListView Adapter , with which I'm creating rows for a
I have a custom ListView adapter which implements an ImageThreadLoader class. Unfortunately, the class
I have a custom ListView adapter which implements an ImageThreadLoader class. Unfortunately the class
i have a ListView for which i have made a custom adapter which extends
I have a ListView which uses a custom adapter to display rows of data.
I have ListView with custom Adapter which supplies View to ListView in this way:
I have a ListView with custom Adapter . To be honest, I have many
I have a ListView with custom Adapter . I have to add at position
I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter

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.