Answer the question
In order to leave comments, you need to log in
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
Show the resource loading code in the activity and then it will be possible to suggest something in more detail.
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.
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 questionAsk a Question
731 491 924 answers to any question