Load ListView in ListActivity and prevent user

by loudo » Tue, 16 Jun 2009 02:02:45 GMT


Sponsored Links
 Hello,

I want to load a list activity from a xml file.
I have done it but i would like to optimize load of data.
I would like to dislplay a message "Loading..." to prevent the user.
I have found progress bar example of  but i don't know when to display
it and how to know the data ar loaded.
I create my listview in the onCreate method. In this method i also
load the xml file and apply to the list view with the setAdapter
function. I think data are diplayed to user just at the end of the
onCreate method so i can't display a message to say data are loading
because data are alredy loaded.

So i just want to know how to load data for a list view and prevent
the user data is loading.

Thanks.

--~--~---------~--~----~------------~-------~--~----~



Load ListView in ListActivity and prevent user

by loudo » Tue, 16 Jun 2009 02:02:52 GMT


 Hello,

I want to load a list activity from a xml file.
I have done it but i would like to optimize load of data.
I would like to dislplay a message "Loading..." to prevent the user.
I have found progress bar example of  but i don't know when to display
it and how to know the data ar loaded.
I create my listview in the onCreate method. In this method i also
load the xml file and apply to the list view with the setAdapter
function. I think data are diplayed to user just at the end of the
onCreate method so i can't display a message to say data are loading
because data are alredy loaded.

So i just want to know how to load data for a list view and prevent
the user data is loading.

Thanks.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Load ListView in ListActivity and prevent user

by adamphillips12 » Tue, 16 Jun 2009 11:29:46 GMT


 If you mean the data is taking awhile to load and you want the
activity to show fast first, then load in the data. Then you should
probably load the data in a thread or you can even use the helper
class ASyncTask. Call it onCreate() and when it finishes execution,
send the result to the list.

You can implement the loading functionality however you want. You
could set the lists emptyview property to a progress indicator if you
really wanted and then change it after the initial load to a proper
empty data message. Or just start with a progress indicator with your
listview not visible etc. Many ways, you'll have to do the research.



--~--~---------~--~----~------------~-------~--~----~



Load ListView in ListActivity and prevent user

by loudo » Tue, 16 Jun 2009 17:37:44 GMT


 Thanks.
Have you got an example ?
What is the emptyview property list ?




--~--~---------~--~----~------------~-------~--~----~



Load ListView in ListActivity and prevent user

by loudo » Tue, 16 Jun 2009 18:04:43 GMT


 I have found this example :
 http://android-developers.blogspot.com/2009/05/painless-threading.html 

What is the emptyview property list ?




--~--~---------~--~----~------------~-------~--~----~