Hi,

ListView has an "empty view" feature. It's a special view that is
shown automatically whenever the list is empty. Refer to the
documentation or samples to see how to use it. It's very easy.

On Mon, May 18, 2009 at 8:10 AM, AusR <[email protected]> wrote:
>
> Hi all,
>
> I have ListActivity to show a custom list. The adapter for this list
> is a complex layout only known for each row at runtime depending on
> data gathered in a previous activity.
>
> The question I have is simple. I know it takes 4-6 seconds to prepare
> the adapter for the rows that will be visible (first 10), however I
> would like to let the user know by means of the empty list
> functionality or otherwise.
>
> At present the ListActivity is launched via a button on a previous
> activity and when that button is clicked the new activity will not be
> loaded until the adapter is completed, and the user is stuck with the
> previous activity until this happens.
>
> Using the basic code below where ListingAdapter is my custom complex
> adapter how can I get the activity to show 'some' element, or even
> appear on screen before the adapter loads so I can display a 'loading'
> message to the user?
>
> Do I need to move the placement of setListAdapter?
>
> @Override
> public void onCreate(Bundle icicle) {
>        super.onCreate(icicle);
>
>                requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
>                setContentView(R.layout.custom_grid);
>
>                new getDataTask().execute();
> }
>
> private class getDataTask extends AsyncTask<String, Integer, Long> {
>        protected Long doInBackground(String... params) {
>                adapter = new ListingAdapter();
>                //setListAdapter(adapter);
>                return null;
>        }
>
>        protected void onPreExecute() {
>                super.onPreExecute();
>                setProgressBarIndeterminateVisibility(true);
>        }
>
>        protected void onPostExecute(Long result) {
>                setListAdapter(adapter);
>                setProgressBarIndeterminateVisibility(false);
>        }
> }
>
>
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to