Thursday, December 23, 2010

Re: [android-developers] Speed up showing Activity with ListView

Hi Johannes,

i think when your list data is in process fetch from server, you can create your listview or other widgets on activity.only you have make sure after thread which one fetching data from server will send message to your ui thread about completion dat fetching. and then on resume you can call your listview adapter notifydatasetchanged. and while your data fetching thread is in progress you can show progress dialog.as far as i concerned this solution will atleast show your list acivity loaded after progess dialog is dissapear

--
Thanks & Regards,
Kapil Lokhande | Dexter Advisory Pvt. Ltd. | Android Developer
dexterlogo.jpg


On Thu, Dec 23, 2010 at 2:44 PM, Johannes De Smedt <johannes.desmedt@gmail.com> wrote:
I have an application that loads a list of items with thumbnails from
a server, and shows those items in a ListView.

The laoding of the data is done before the ListViewActivity is started
and while that is being done, a ProgressDialog is shown. When the
loading of the data is done, I start an activity with a ListView that
displays the items. The thumbnails are downloaded in a seperate thread
when they are needed in the getView method of ListView.

This is my problem: When the loading of the data is done, I call
startActivity with an Intent to start the ListActivity and in that
intent I put the data.
My problem is that this takes a few seconds sometimes. How can I speed
this up?

Below is the sequence + where it goes wrong:

The items are downloaded with an AsyncTask that shows a
ProgressDialog.
The progressDialog is dissmissed, and startactivity is called.

Intent in = new Intent(CategoryListScreen.this,
VideoListScreen.class);
in.putParcelableArrayListExtra("items", items);
startActivity(in);

The listAdapter is created in the onCreate method of my
VideoListScreen
getView is called a few times...
The VideoListScreen is displayed (a few seconds after the
progressDialog has been dissmissed)

Also the Logcat output from the ActivityManager indicates it takes a
few seconds for my activity to start:
E.g:
10:13:22.254 - ActivityManager - Starting activity: VideoListScreen
10:13:25.424 - ActivityManager - Displayed activity: VideoListScreen:
3166 ms

How can I make that the activity is displayed faster?

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

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

1 comment: