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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:40:05+00:00 2026-05-31T06:40:05+00:00

I am using a ListView as shown below in filename browse.xml. <ListView android:id=@+id/listView1 android:layout_width=250dp

  • 0

I am using a ListView as shown below in filename browse.xml.

<ListView
   android:id="@+id/listView1"
   android:layout_width="250dp"
   android:layout_height="match_parent"
   android:layout_alignParentLeft="true"
   android:layout_below="@+id/relativeLayout1" >

</ListView>

And I am filling this listView inside onCreate() method as:

files1=new ArrayList<String>();
File sdcard=Environment.getExternalStorageDirectory();
files1 =  getListFiles(new File(sdcard.getAbsolutePath()+File.separatorChar)); 
ArrayAdapter<String> fileList =new ArrayAdapter<String>(this, R.layout.row,files1);

setListAdapter(fileList);

row.xml is shown below as:

<?xml version="1.0" encoding="utf-8"?>
<TextView 
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/rowtext"
   android:layout_width="fill_parent"
   android:layout_height="40dp"
   android:textSize="20dp" 
   android:textColor="#000000"   
   android:background="#FFFFFF"/>

This whole program is am showing all the files of sdcard at listView and on click of any listitem, am saving that file name into sharedPrefernce..Now I want to change the text color of file name(List items) in the ListView which are there in SharedPrefernce..

[EDIT]: Here am using ArrayAdapter default constructor to list all the items in a listview

Pls suggest me something..
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-31T06:40:06+00:00Added an answer on May 31, 2026 at 6:40 am

    We can change the textcolor dynamically for list item in the getView() of Adapter.

    public View getView(int position, View convertView, ViewGroup parent) {
        View row = convertView;
    
        if (row == null) {
            row = LayoutInflater.from(parent.getContext()).inflate(R.layout.row, null);
        }
    
        TextView listTitle = (TextView) row.findViewById(R.id.rowtext);
        listTitle.setTextColor(Color.parseColor("#405478"));
    
        return listTitle;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In past, I am using Listview and using below code can show a particular
Below is the code currently I am using for grouping in listview . I
I am using arrayadapter to show data on listview.What i have coded is shown
How to show in the WPF Listview using the GridView an empty text (like
I'm using a PopupWindow to show some subcategories when clicking on a ListView item.
I am using a list view in Android 1.5 to show a list of
I am using ListView/DataPager. For performance reasons I page my results at database, using
I am using listview to display three textviews(values for these text views where come
What are the advantages of using listview over gridview? I need pagination, editing rows,
How do I do pagination using ListView. For an example, I have 12 records

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.