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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:12:40+00:00 2026-05-28T07:12:40+00:00

I am trying to update the ListView with timer . I have implemented the

  • 0

I am trying to update the ListView with timer. I have implemented the android UI timer but my problem is how to use it for ListView where I need to update each row of the list after a certain interval. How does the handler will update the each row of the list (i.e. suppose a TextView is inside the each row where I’ll display the updated values)?

public class ListAdapter extends BaseAdapter {

    private List<String> messages;
    private Context mContext;

    public ListAdapter(Context context , List<String> messages){
        this.messages   =  messages;
        mContext   =  context;
    }

    @Override
    public int getCount(){
        return messages.size();
    }

    @Override
    public Object getItem(int location){
        return messages.get(location);
    }

    @Override
    public long getItemId(int index){
        return index;
    }

    @Override
    public View getView(int index , View convertView, ViewGroup viewGroup){

            TextView time = new TextView(mContext);

                //udpate the time.setText() using timer
        convertView = (View)time

        return convertView;
    }   
  • 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-28T07:12:41+00:00Added an answer on May 28, 2026 at 7:12 am

    Create a customHandler class that extends Handler class and call the sendEmptyMessage() of handler from the timer run() method.

    In the Handler class override the handleMessage and update your listview values and call adapter.notifyDataSetChanged() which will refresh the listview with the updated values.

    Here is the sample code :

    Timer timer = new Timer();
    CustomTimerTask customTimerTask = new CustomTimerTask();
    customTimerTask.run();
    timer.scheduleAtFixedRate(customTimerTask, 1000 , 1000);
    
    class CustomTimerTask extends TimerTask {
    
        @Override
        public void run() {
            myHandler.sendEmptyMessage(0);
        }
    }
    
        class CustomHandler extends Handler{
    
    
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            /// Do your listview update thing
     }
    

    }

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

Sidebar

Related Questions

Question. I'm trying to use SQL to update a listview in C#. Using the
I am trying to update controls in the of a ListView control after handling
I trying to update a model on a callback but the validation is causing
I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException:
I'm trying to implement a C# drag and drop row-reorder with a listview which
I have a ListView of items that need to be checkable/uncheckable. I have set
I'm trying to build a Listview EDIT/Insert template where I can use a checkbox
I'm trying just to get a simple ListView to update when clicking an add
I have a listview, with around 200 items, I have implemented a custom ArrayAdapter
I am trying to use handle database with insert, update, and delete such as

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.