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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:32:04+00:00 2026-05-30T10:32:04+00:00

I am populating a Listview (list.xml) with a textview (list_row.xml). I need to add

  • 0

I am populating a Listview (list.xml) with a textview (list_row.xml).

I need to add an additional textview to list_row.xml, which means I need to wrap them in a layout. However, I get a Textview ID error when I do this.

list_row.xml I need:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TextView android:id="@+id/nameTV"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#FFFF00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

</LinearLayout>

Main.xml

public View GetView(int inPosition, View inConvertView, ViewGroup inParent) 
{
    View _row = inConvertView;

    if (_row == null) 
    {
        // Inflate Row
        Log.d(TAG, "Starting XML Row Inflation ... ");
        LayoutInflater inflater = (LayoutInflater) 
                cContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        _row = inflater.inflate(R.layout.list_row, inParent, false);
        Log.d(TAG, "Successfully completed XML Row Inflation!");
    }

    // Get item
    PropertiesAd _adProperty = GetItem(inPosition);

    // Get reference to TextView - country_name
    cAdName = (TextView) _row.findViewById(R.id.nameTV);

    //Set name
    cAdName.setText(_adProperty.toString());

    return _row;
}

For the sake of testing, I haven’t added the second textview yet. I’m just trying to get this to work with the layout wrapper.

Everything works fine without the LinearLayout. But again, I will need it to add a second textview. Suggestions?

Thanks

ArrayAdapter:

public class ArrayAdapterAd extends ArrayAdapter<PropertiesAd> 
{

private static final String TAG = "AdArrayAdapter";
private Context cContext;
private TextView cAdName;
private List<PropertiesAd> cAdList = new ArrayList<PropertiesAd>();

public ArrayAdapterAd(Context inContext, int inTextViewResourceId, List<PropertiesAd> inObjects) 
{
    super(inContext, inTextViewResourceId, inObjects);

    this.cContext = inContext; 
    this.cAdList = inObjects;
}


public int GetCount() 
{
    return this.cAdList.size();
}


public PropertiesAd GetItem(int inIndex) 
{
    return this.cAdList.get(inIndex);
}


public View GetView(int inPosition, View inConvertView, ViewGroup inParent) 
{
    View _row = inConvertView;

    if (_row == null) 
    {
        // Inflate Row
        Log.d(TAG, "Starting XML Row Inflation ... ");
        LayoutInflater inflater = (LayoutInflater) 
                cContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        _row = inflater.inflate(R.layout.ad_list, inParent, false);
        Log.d(TAG, "Successfully completed XML Row Inflation!");
    }

    // Get item
    PropertiesAd _adProperty = GetItem(inPosition);

    // Get reference to TextView - country_name
    cAdName = (TextView) _row.findViewById(R.id.ad_listTextView);

    //Set country name
    cAdName.setText(_adProperty.toString());

    return _row;
}

}

  • 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-30T10:32:06+00:00Added an answer on May 30, 2026 at 10:32 am

    Now I see your problem… you cannot do that extending the ArrayAdapter class. Instead, extend BaseAdapter.

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

Sidebar

Related Questions

I'm populating a ListView which contains an ImageView and a TextView. It doesn't crash,
I'm populating a ListView with items and add images from an ImageList (in the
I'm populating a listview with a list of databases on a selected SQL instance,
I am populating the ListView from my Custom DataAdaptor. I have a layout defined
I have a listview, which displays a list of administrators, this list is held
I have a ListView which sometimes I need to put around 10000 items in.
I am creating and populating a list with jQuery and want to add an
Here's my current code. Basically it's populating my list with 'com.teslaprime.prirt.Task@44ef98aO' which I assume
I have a listview which is simply populated this way: setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, aux))
I have a listview which I am populating with a custom SimpleCursorAdapter, each row

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.