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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:22:44+00:00 2026-05-21T04:22:44+00:00

sorry for the poor choice of words, I dont know exactly how the Android

  • 0

sorry for the poor choice of words, I dont know exactly how the Android terminology is, therefore google wasn’t much help either.

What I need to do seems simple: I have a table as part of my “main view” which is created when the activity launches. No problem here, I can get the table in code and e.g. add rows.

What I would like to do is “prepare” the row in a different XML file, basically creating the layout using XML and then creating an instance of that TableRow in code, adding it to my main table.

I know the alternative approach (to create the whole row in code), but this would be more cumbersome then using XML for most of the attributes, and only fill the ones I need later by code (label and image).

[UPDATE]

Ok, I managed to solve half of my problem using the ListActivity. There is one little problem remaining, I don’t know how to tell Android to use more then one string.

The code looks like this:

public class ListScreenAlle extends ListActivity {

String[] listItems = {"exploring", "android", "list", "activities"};

@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);

    // We'll define a custom screen layout here (the one shown above), but
    // typically, you could just use the standard ListActivity layout.
    setContentView(R.layout.list_screen_layout_alle);

    //setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, listItems));
    setListAdapter(new ArrayAdapter(this, R.layout.list_row_single, listItems));
}

}

And the XML used for the row looks like this:

<?xml version="1.0" encoding="utf-8"?><TextView android:id="@+id/text1"  xmlns:android="http://schemas.android.com/apk/res/android"
     android:textSize="16sp"
     android:textStyle="bold"
     android:layout_width="match_parent"
     android:layout_height="wrap_content" android:textColor="@color/text_color_list_label"/>

How do I change this code to support a more complex object than a single string. Eg a person with a thumbnail and firstname, lastname.

The ArrayAdapter in its simple form only allows a single textfield, how would I explain to it that my row has 3 fields, an image, two strings, and that it should “BIND” the image to property Thumbnail, and the textfields to firstname and lastname?

  • 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-21T04:22:45+00:00Added an answer on May 21, 2026 at 4:22 am

    Have a look at ListActivity and/or ListView.

    edit regarding your update: use SimpleAdapter instead of ArrayAdapter

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

Sidebar

Related Questions

Sorry for the poor title,I'm new to OOP so I don't know what is
Sorry for the poor question wording I wasn't sure how to describe this. I
I need some help (sorry for my poor english). I 'm trying to get
Sorry for the poor title, I don't really know what to call this. I
Sorry for my poor math/music knowledge.. Assumed whe want to play a video file
Sorry for the poor title, can't think of a succinct way of putting this..
First, I am really sorry for my poor english. Now when I use Ext.List
Sorry ,my English is poor, I have never speak English after I leave the
@Oded: Sorry to have been poor in my exposition... My input document has a
Sorry, I know this question is easy, but I don't know how to get

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.