Solved

ListView refresh async

Posted on 2014-04-28
2
1,927 Views
Last Modified: 2014-05-31
Hi, i would like to know whats the cleanest and better way to implement autorefresh (async) on a ListView in android.

Sometimes users are checking the info in the listview and in the meantime they get an update via service.

How to display to the current ListView?
Does this envolve a service requesting the update every time?

Any clean aproach would be great to receive.
0
Comment
Question by:JavierVera
2 Comments
 
LVL 12

Accepted Solution

by:
KRUNAL TAILOR earned 500 total points
ID: 40028800
Hi JavierVera,

Are you talking about the similar to facebook feed? (This is for Manual Refresh)
If Yes, in that case you have to use  pulltorefresh and ScrollListener concepts in the app. There are many Pull to refresh library available for android.

Or

Are you talking about the "Auto refresh"? (This is for Auto Refresh)
Then, You need to add iteminfo from ArrayList from Adapter and call notifyDatasetChanged() , When you call notifyDatasetChanged() method it will refresh your listview with ArrayList with updated data.

Also see some ref stuff over here below.

Ref:
1) http://stackoverflow.com/questions/23124414/android-auto-refresh-when-new-data-inserted-into-listview
2) http://androidadapternotifiydatasetchanged.blogspot.in/

Hope this will help you.

Thanks & Regards,
Krunal T. Tailor
0
 
LVL 1

Author Closing Comment

by:JavierVera
ID: 40102995
Hi there, thank you for guiding me on the correct path and options!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 36
Applications for Android phones and other phones. 13 70
type mismatch (Object[] to double[] 4 23
Java: anonymous class 4 17
A short article about a problem I had getting the GPS LocationListener working.
This is an explanation of a simple data model to help parse a JSON feed
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question