Roman Panaget
Roman Panaget

Reputation: 2428

Android - loading a big Activity

I am running an activity from another one but I have to inflate like 200 views so it takes 3-4 seconds to start. How do you recommend me to do? Should I make a loading screen? If yes, how hould I do that?

EDIT: is it possible to load the onCreate() of an activity at the beggining of the app and show the activity later ?

Upvotes: 1

Views: 190

Answers (1)

Damien Belard
Damien Belard

Reputation: 285

Yes you should make a loading screen, 3-4 seconds are too long for a user to wait without a loading screen (most will think app is frozen and kill it).

You can try this:

  1. put you interface into a fragment instead activity
  2. load blank activity with setContentView()
  3. launch a ProgressDialog or something else
  4. inflate the fragment
  5. when inflating is finished, display the fragmetn in the activity and dismiss the dialog

Upvotes: 1

Related Questions