Daniel
Daniel

Reputation: 3374

Update ListView from adapter Instantly

I'm developing an application that shows stock market information. In my application I use listactivity and my own adapter is being used. The listView used to show the stocks is working fine and is updated with correct data. The only problem is, although I use

 adapter.notifyDataSetChanged(); 

the list isn't updated until scrolling and items subjected to change, are scrolled out from the screen. When they are scrolled in, they appear with new data. I need to change the data as soon as I notify the adapter.

Upvotes: 2

Views: 3101

Answers (3)

Parag Chauhan
Parag Chauhan

Reputation: 35946

I have face same problem but finally got solution And its solution is

listView.invalidateViews();

Upvotes: 2

instanceMaster
instanceMaster

Reputation: 501

Are you calling notifyDataSetChanged in UI thread? If not: you can do the following:

runOnUiThread(new Runnable() { public void run() { adapter.notifyDataSetChanged(); } });

Upvotes: 1

mayur rahatekar
mayur rahatekar

Reputation: 4460

I think for that you have to take the help of the Lazy ListView or Lazy Loader:

Check out the below link :

Lazy load of images in ListView

It will help you.

Upvotes: 2

Related Questions