I am developing android application. Now I have to create the app of newspaper. So on home page I have to display top stories with the images and the text. Now my problem is, there should be so many top stories so I have used horizontal scroll bar to see other stories. Now my idea is to load the images and the text when the user scrolls left or right. Is it possible to do or I have to load all the data on create of the activity. Any help or suggestion is appreciated.
Asked
Active
Viewed 419 times
0
-
What do you use for horizontal scroll? The bar is only an indicator, gallery? Workspaces? Another library? – David Olsson Mar 13 '12 at 07:30
-
What you are asking about is lazy-loading. And try using listView instead of scroll-bars – 0xC0DED00D Mar 13 '12 at 07:31
-
either load all data in AsyncTask or you can load data in your adapter's getView method...but the first option is better – MKJParekh Mar 13 '12 at 08:52
1 Answers
0
If what you are asking about is Lazy-Loading, then you need to use AsyncTask
, as it's the easiest method to implement it.
class Download extends AsyncTask<Integer,Integer,Integer>{
protected Integer doInBackground(Integer... wat) {
//Your downloading stuff
}
protected Integer onPostExecute(Integer result){
//Create listview in UI Thread
}
}
To create an horizontal ListView read here

Community
- 1
- 1

0xC0DED00D
- 19,522
- 20
- 117
- 184