Johannes,
Take a look at code in your onCreate, to see what's taking too long.
Add logging statements at entry to onCreate and after each step of the
work it does.
Another reason could be that you kick off a thread in onCreate, and that
thread does a lot of processing right away - using too much of the CPU,
thus slowing down the main thread.
To test this theory, add a delay for a few seconds at the beginning of
the thread's work function (call Thread.sleep or wait), and see if it
makes a difference.
-- Kostya
23.12.2010 12:14, Johannes De Smedt пишет:
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?
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
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