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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:22:42+00:00 2026-05-28T07:22:42+00:00

I have a list that is populated by a listadapter that specifies a layout

  • 0

I have a list that is populated by a listadapter that specifies a layout like so:

SimpleCursorAdapter trips = 
new SimpleCursorAdapter(this, R.layout.it_menu_home_row, tripsCursor, from, to);

Inside of that layout is a textview. I would like to be able to dynamically change the width of that textview through code. I have tried just referencing the textview ID with findViewById, but when I try to manipulate it, I get a null pointer exception.

Is there a simple way reference the textview of a listadapters layout?

I am trying to reference the text view like I would if it was sitting in the base layout of the activity:

TextView tv = (TextView)findViewById(R.id.myTV);

I don’t know if I have to somehow iterate through each of the list items and manually set the textView that way (and if I do I am not sure how), or if I just have to reference it once, etc

  • 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-28T07:22:43+00:00Added an answer on May 28, 2026 at 7:22 am

    When you use SimpleCursorAdapter you provide the textFields via the constructor itself. In the snippet you have given, to should be an array of id’s of the TextView’s present.
    For example if your layout file has a TextView with the id: "@+id/my_textfield" then you should pass in your constructor an array: int to[]=new int[]{R.id.my_textfield};

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

Sidebar

Related Questions

I have a dropdown list that is populated when the page loads, like this:
I have a dropdown list that is populated on a content page like this
So I have this array list that is populated using a csv file. Once
I have a dropdown list that is currently populated from a result set of
I have list of MyObject that looks like this: public class MyObject{ public int
I have a list that is automatically populated from an XML DataSource using bindings.
We have an auto-complete list that's populated when an you send an email to
I have about 10 drop down list controls that get populated. Instead of copying/pasting
I have a report with a parameter that is populated by a list of
I have a full list that populates a UITableView . This I want to

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.