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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:21:31+00:00 2026-06-15T20:21:31+00:00

I have implemented a Section header Listview where i inflate a layout which have

  • 0

I have implemented a Section header Listview where i inflate a layout which have three textviews in it as item.i have referred this example here to achieve it.

My code is

adapter.addSection(monthitems2[l], new SimpleAdapter(this, security, R.layout.phone_row, 
                new String[] {"Title", "Caption","val1" }, new int[] { R.id.tvContact, R.id.tvMobile,R.id.tvMail }));

I have a condition where i need to change text color of ID “R.id.tvContact”.I havent defined the textview anywhere in thelayout.i have just referred it as simpleadapter parameter.How to change the textview color the default is white.Any suggestions answers are highly appreciated.

  • 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-06-15T20:21:33+00:00Added an answer on June 15, 2026 at 8:21 pm

    From the reference tutorial, you have

    SeparatedListAdapter adapter = new SeparatedListAdapter(this);  
    adapter.addSection("Array test", new ArrayAdapter<String>(this,  
            R.layout.list_item, new String[] { "First item", "Item two" }));  
    adapter.addSection("Security", new SimpleAdapter(this, security, R.layout.list_complex,   
            new String[] { ITEM_TITLE, ITEM_CAPTION }, new int[] { R.id.list_complex_title, R.id.list_complex_caption }));  
    
    ListView list = new ListView(this);  
    list.setAdapter(adapter);  
    this.setContentView(list);  
    

    Get a handle to your TextView, then set its color from that handle. You need to Post the
    commands to the message queue, in a runnable, b/c at this point in the code the ListView hasn’t yet rendered the TextView’s that the adapter points to (that will happen sometime after OnCreate exits).

    list.Post(() => 
    {
        TextView tv = list.FindViewById<TextView>(R.id.tvContact);
    
        tv.SetTextColor(Color.Red);
    });
    

    I don’t think you need to qualify FindViewById with list. b/c you set the content view with

    this.setContentView(list);
    

    (above code in C# for MonoDroid, easily convertable to Java).

    Posting runnables in Java/Android: How to run a Runnable thread in Android?

    Posting in runnables puts the code in the message queue, a key, undocumented construct in Android. Anytime you get a null reference from an activity when modifying Views, try this as a first step.

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

Sidebar

Related Questions

I have implemented Section Indexer for an Adapter class which extends BaseAdapter. Now for
I have a ListView in which each List item has a Spinner . I
I am currently writing a Java compiler and have implemented section 15.12.2.7. of the
I am building an iPhone app and I have implemented a section for knowledge
I have implemented correctly bump's api, and added this code: - (void) configureBump {
I have seen some iPhone apps in which they show first section of rows
I have implemented a Section Index for my tableview. It returns the correct letters
I have a UITextField in a custom section header. There are multiple sections using
I have implemented jScroll plugin from here If you go to view my project
I'm using a database that is implemented in a ListView. I want to section

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.