[android-developers] Re: Loading many sound clips leads to long app start times
Ok, I fixed my problem, so I thought I would post what I did here for
historical purposes.
Rather than load up all sound clips at once, I divided my loadClips()
into groups of 10 clips in a case structure. On app-start, I load 10
clips, on the button press, I load 10 more, and continue to do this
until all sound clips are fully loaded (for now that's 6 button
presses for me, not bad). Each case returns a new 'max' number of
clips value back to the random clip player so it compensates for the
added clips.
I know this solution is probably basic or easy in most people's eyes,
but it took me a bit to figure out :)
On Sep 15, 9:40 pm, fog <cquill...@gmail.com> wrote:
> Hello all, after searching for a while for a solution to my issue, I
> thought I would post the question here to see if someone has a better
> answer.
>
> First off, I'm very new to Android programming, and programming in
> general (i've only really worked with PHP in the past), so I've been
> kinda learning as I go along with examples, tutorials and books. The
> application is very basic, its a soundboard app with only 1 button.
> When pressed, that 1 button will play 1 random soundclip. Currently,
> there are 79 sound clips, with more to be added in a future update.
> As I have it right now, i execute loadClips() on the app's onCreate,
> which goes ahead and loads all 79 sounds into the SoundManager.
>
> As it stands right now, the app is functioning fine, however, I do
> notice a bit of a delay when launching the app on my HTC Desire Z, but
> nothing too crazy, its probably around 5-6 seconds. However, when I
> load it on my Asus Transformer tablet, it takes considerably longer
> (about 15 seconds or so). My guess was that not many people would be
> downloading the app for the Transformer, so I released it anyways.
>
> So far, I've had only 1 complaint from a user who says that it takes a
> little over 15 seconds to load the app on his HTC Magic+, in the
> meantime he's just staring at a blank screen. But he was fine with
> dealing with that.
>
> Now, we're working on an update for the app, and my friend who is
> making the iPhone version will be adding in a bunch more clips into
> the app. My fear is that it will further increase the app's startup
> time, which I believe to be unacceptable. Thus, I'm trying to find
> out if there's a better way to do this.
>
> Any ideas on how I could do this? Do you need to see my code in order
> to offer a suggestion.
>
> Also, as a side question, when adding clips to my sound manager, is
> there an easier way than having 79 lines of
> "mSoundManager.addSound(X,R.raw.soundX); like in some sort of loop. I
> did originally try to do a for loop, but quickly realized that
> wouldn't work directly.
>
> Thanks for any help you can give.
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home