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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:59:06+00:00 2026-05-23T09:59:06+00:00

I have show Array in listview. with black text color. if i using android.R.color.black

  • 0

I have show Array in listview. with black text color.

if i using android.R.color.black it will give runtime error.

this is my code.

list1 =(ListView)findViewById(R.id.scoreView1);
        list2 = (ListView)findViewById(R.id.scoreView2);

    for (int i = 1; i <= 3; i++) {
        datalist1.add("Qustion "+ i + "   Correct");
    }
    for (int i = 4; i <= 6; i++) {
        datalist2.add("Qusetion "+ i + "  Correct");
    }



    list1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,R.color.TextColor,datalist1));
    list2.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,android.R.id.text1,datalist2));

my XML:

<resources>

<color name="Background">#E2E2E2</color>
<color name="TextColor">#040404</color>
<color name="White">#FFFFFF</color>
<color name="Black">#000000</color>
<color name="Red">#FF0000</color>
<color name="Green">#4AA02C</color>

</resources>

Any suggestion?

  • 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-23T09:59:07+00:00Added an answer on May 23, 2026 at 9:59 am

    list1.setAdapter(new ArrayAdapterthis,android.R.layout.simple_list_item_1,R.color.TextColor,datalist1));

    You are using this constructor for the array adapter. The third argument is

    textViewResourceId The id of the TextView within the layout resource to be populated

    and you are giving TextColor. You should provide layout id.

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

Sidebar

Related Questions

Android:How to display images from the web in a ListView?I have the following code
When using CDT I would like to have std::string show up in the 'variable'
I'm using ListView in VirtualMode to show extremely big number of rows, millions of
Im trying to display this listview, but I keep getting a: 07-17 21:14:22.233: ERROR/AndroidRuntime(349):
I am sorry about the amount of code here. I have tried to show
I have a working android app using TextView, some formatting (line breaks, rows of
I have a ListView that displays every item in an array called, Facts_Array. What
I have one ListView which is showing me some data through an array (which
I have a problem on refresh the listview using thread. How to use it
I need a dynamic string-array. All the examples I have seen show hard-coded string-arrays.

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.