L
L
LockUs2017-05-21 14:45:38
Android
LockUs, 2017-05-21 14:45:38

How to speed up the loading of one activity of the second level?

I am developing an application in two languages ​​with a small number of activities:
1. Home (buttons: Activities, Exercise)
1.1. Activities
1.1.1. Sign up for an event
1.1.2. Refuse to participate
1.2. Exercise
The first four activities load quickly. But the "Exercise" activity takes a long time to load - initially, when I planned to do only "Exercise", this problem was solved by the Launcher, but now I can't figure out how to use the Launcher for a secondary activity.
According to the resources in the "Exercise" activity: background (20Kb), 3 mipmaps (5 sizes from 2.5 to 10Kb each) and 16 sound files of 20Kb each (for each of the two languages).
Tell me, please, how to do it right with the "Exercise" activation? Load it somehow in advance? Or can sounds be loaded only when they are needed? Load it first with Launcher and then call the "Home" activity on top? Maybe you can somehow still call the Launcher on a secondary activity?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
priamm, 2017-05-21
@priamm

Show the resource loading code in the activity and then it will be possible to suggest something in more detail.

L
LockUs, 2017-05-21
@LockUs

In onCreate I create an array of objects to which I immediately bind the desired sound:
but[0].sound=loadSound(getResources().getString(R.string.crown_sound));
but[1].sound=loadSound(getResources().getString(R.string.right_ear_sound));
but[2].sound=loadSound(getResources().getString(R.string.nose_sound));
And the background and mipmap are attached to the imageview in layout.

D
Denis Zagaevsky, 2017-05-21
@zagayevskiy

Download sounds delayed and preferably on a different thread. Do not load them in onCreate everything, load them as needed - this will greatly improve.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question