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);
        }
}


--~--~---------~--~----~------------~-------~--~----~
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