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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:25:34+00:00 2026-05-28T02:25:34+00:00

I wanted to update my layout from <?xml version=1.0 encoding=utf-8?> <TextView xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent

  • 0

I wanted to update my layout from

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp"
    android:textSize="16sp" >
</TextView>

To

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<TextView
    android:id="@+id/maintitle"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:padding="10dp"
    android:text="@string/choose_contact"
    android:textSize="16sp" />

<TextView
    android:id="@+id/contentlist"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp"
    android:textSize="16sp" />
</LinearLayout>

So I can have that header text. Now, I was using

setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, arraylist));

To send my data, but I’m now getting a “ArrayAdapter requires the resource ID to be a view”. So I’m trying to use a different constructor, namely

ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)

to reference the specific ID of my textview, but I haven’t found out how to do so.
I thought it would be something along the lines of

R.layout.list_item.id_of_my_txtview

How do I reference the textview id to use this constructor?

thanks

  • 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-28T02:25:34+00:00Added an answer on May 28, 2026 at 2:25 am

    Reference your TextView ID as any other View ID: R.id.id_of_the_view. Reference: XML Layouts – ID.

    Code will look like this:

    setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.contentlist, arraylist));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually i wanted to update my existing Ghostscript from version 9.02 to 9.05 latest
Being a relative submodules noob, I wanted to update my submodule with from its
Up to now when I wanted to update an UI control from a non
I wanted to update an old VBA Excel application with new images. The application
I wanted to update my python 2.6.1 to 3.x on mac but I was
After some time I wanted to update my git repo, and then something went
i have two list, i wanted to update the second list while adding a
UPDATE: Based on rrenaud's great comment I wanted to clarify that although I'm generating
I just wanted to know if there is any method available to update a
I have a ListView inside of an Update Panel and wanted to change the

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.