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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:24:16+00:00 2026-06-04T10:24:16+00:00

I have some values coming from a datasource that I have control over. I

  • 0

I have some values coming from a datasource that I have control over. I am stuffing those values into a ListView. The values go something like this:

"You have X books overdue". This is a silly example but it gets the point I’m trying to understand. Everything EXCEPT X is static however when the ArrayAdapter populates the ListView the only thing that shows is X. This of course make sense.

I can think of two ways to solve this problem. One is to modify my data source so the entire message is provided; this makes life simple on the GUI side but my database colleagues are definitely going to frown.

On the other hand I can find the TextView by id and concatenate EXCEPT ListView is just a representation of the underlying data so really I would modify the data AFTER getting it from the db then update / redraw the list view?

  • 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-04T10:24:17+00:00Added an answer on June 4, 2026 at 10:24 am

    Attach a Binder to your list adapter and modify the data that gets set into it. Assuming you have an adapter called myAdapter:

    myAdapter.setViewBinder(new MyViewBinder());
    
    public class MyViewBinder implements ViewBinder {
        @Override
        public boolean setViewValue(View view, Object data, String text){
            if(view instanceof TextView){
                ((TextView)view).setText(String.format("You have %s books overdue",text));
            }
        }
    }
    

    When you reach the ViewBinder in your code, the program is trying to populate your list. You’d then check if the view is as instance of TextView and if so, using the variable text which in this case is the element from position X of your data source, we create a String with format including the source data.

    If you have multiple views being populated for each row, you can check the id with view.getId()

    Without a ViewBinder, your data gets mapped to the views as specified on the adapter, but with the ViewBinder in place you can do all sorts of cool stuff like, alternative background color for the rows or making a view clickable depending on the content of the source, the possibilities are endless.

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

Sidebar

Related Questions

I have some negative values coming back from a query. I would like them
i have to insert and update some values which is daily coming from excel
I have some values in a configuration file (XML file) with some values like
In my C++ application, I have some values that act as codes to represent
I have some code that sets up a dictionary with some defualt values for
I have to transfer some values to be used as commands over the network,
Introduction I have some sort of values that I might want to access several
I have some problem whith such mysql_query INSERT INTO table VALUES ('', CURDATE()-1) why
I have a UITableView that was created from data coming from a mutable array.
I have a question about where values in dropdowns are coming from: I have

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.