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 ?




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



Other Threads

1. SSL handshake failure when client certificate is requested

I am also looking for using custom keystore, do you know how generate and
store cert and priv key in keystore programmatically ?




> 

2. customlistadapter simple question

I am displaying some data in a ListActivity. my Layout contains a
ListView. Now I need to group these data into 3 groups in a single
list. these 3 groups of data will come from 3 different queries. now
the question is can I use 3 listviews in them and set separate
arryAdapters for each ? If yes, how will setListAdapter call look
like ? it takes a ListActivity instance, isn't it ?

Otherwise how can I group these into 3 different groups ?

setListAdapter(new ArrayAdapter<String>(this,
                                android.R.layout.simple_list_item_1, items));

how can I change the heights of the rows ? currently those look a
little broad.

regards

-- 

3. MediaPlayer - Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported

4. Video rotate function

5. How to submit device driver into Android kernel source code?

6. How to submit device driver into Android kernel source code?

7. Gallery: "Low Memory: No more background processes."