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

  • Home
  • SEARCH
  • 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 1064017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:52:05+00:00 2026-05-16T18:52:05+00:00

I have a custom list adapter contains a layout with controls in it. I

  • 0

I have a custom list adapter contains a layout with controls in it. I was wondering how I can get each individual controls id? I am planning on changing the color of some textviews.

private void UpdateDisplay() {
    // define the list which holds the information of the list
    List<Map<String, Object>> resourceNames = new ArrayList<Map<String, Object>>();

    // define the map which will hold the information for each row
    Map<String, Object> data;

    if (appts.size() > 0) {
        for (int i = 0; i < appts.size(); i++) {
            data = new HashMap<String, Object>();

            data.put("apptListType", appts.get(i).getType().getName());
            data.put("apptListTime", DateFormat.getTimeInstance(
                    DateFormat.SHORT).format(appts.get(i).getStartDate())
                    + " - "
                    + DateFormat.getTimeInstance(DateFormat.SHORT).format(
                            appts.get(i).getEndDate()));
            data.put("apptListContactName", appts.get(i).getContact()
                    .getFullName());
            data.put("apptListContactCompany", appts.get(i).getContact()
                    .getCompany());
            resourceNames.add(data);
        }
    } else {

        data = new HashMap<String, Object>();

        data.put("apptListType", "No appointments found for today.");
        data.put("apptListTime", "");
        data.put("apptListContactName", "");
        data.put("apptListContactCompany", "");
        resourceNames.add(data);

    }

    apptDescription = new SimpleAdapter(this, resourceNames,
            R.layout.apptlistitem, new String[] { "apptListType",
                    "apptListTime", "apptListContactName",
                    "apptListContactCompany" }, new int[] {
                    R.id.apptListType, R.id.apptListTime,
                    R.id.apptListContactName, R.id.apptListContactCompany });
    ListView apptList = (ListView) findViewById(R.id.apptsList);
    apptList.setAdapter(apptDescription);

    apptList.setOnItemClickListener(AppointmentDailyView.this);

    apptList.setItemsCanFocus(true);

and here is my xml file for each listitem:

<?xml version="1.0" encoding="utf-8"?>

<TextView android:id="@+id/apptListType" android:textSize="20px"
    android:textColor="#333" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:textStyle="bold" />

<TextView android:layout_below="@+id/apptListType" android:id="@+id/apptListTime"
    android:textSize="15px" android:textColor="#666" android:layout_width="wrap_content"
    android:layout_height="wrap_content" ></TextView>
<TextView android:layout_below="@+id/apptListTime" android:id="@+id/apptListContactName"
    android:textSize="20px" android:textColor="#333" android:layout_width="wrap_content"
    android:layout_height="wrap_content"></TextView>

<TextView android:layout_toRightOf="@+id/apptListContactName"
    android:layout_below="@+id/apptListTime" android:id="@+id/apptListContactCompany"
    android:textSize="15px" android:textColor="#666"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:paddingLeft="5px" android:layout_marginTop="3px"></TextView>

Any help is appreciated, 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-16T18:52:05+00:00Added an answer on May 16, 2026 at 6:52 pm

    Step #1: Extend SimpleAdapter into your own class (referred to here as MyAdapter)

    Step #2: Override getView() in MyAdapter

    Step #3: Chain to the superclass (i.e., call super.getView()) from getView(), which returns the View for this row

    Step #4: Call findViewById() on the row View to get at the widgets inside of it, and tailor those as you see fit

    Step #5: Return the row View from getView() in MyAdapter

    Step #6: Use MyAdapter where you are using SimpleAdapter

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

Sidebar

Related Questions

I have defined a custom Sharepoint list for special attributes related to a software
I have a custom class Contact . I am trying to bind a List<Contact>
I have a DataGridView with its datasource set to a generic list of custom
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For
I have custom coded several enterprise applications for mid to large organizations to use
I have custom errors configured in my web.config, but IIS 6.0 is returning the
I have a few models that need to have custom find conditions placed on
hi i would like to create a custom calendar, this calendar will have custom
I have a custom validation function in JavaScript in a user control on a
I have a custom built ajax [div] based dynamic dropdown. I have an [input]

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.