Hey DanielleM, how about you start the media as a service - does that
change the behavior?

On Feb 14, 2:15 pm, DanielleM <[email protected]> wrote:
> Hello all:
>
> I'm trying to use an AsyncTask to prepare two MediaPlayer objects
> while the rest of my activity loads. However, I've noticed that once
> everything is loaded...I'm able to play my media player just fine, but
> if I switch to another activity in my app and then switch back to the
> media player activity the Media Player objects get re-created and so
> the code I have in the onClick listeners for the buttons no longer
> works.
>
> Basically, the app loads, the streams are set up..once this is done
> you can press play to play one of the streams and then stop to pause
> it. But if I switch to another activity while the streams are playing
> and then go back to the MediaPlayer activity, I can no longer stop the
> streams.
>
> Does an AsyncTask run every time the activity is brought back to the
> front? That doesn't seem right since the code is in the onCreate
> method and the activity should not be re-created every time it's
> brought back to the front.
>
> If anyone can shed some light on what's happening here I'd really
> appreciate it.
>
> The buttons and streams were functioning properly before I started
> pushing the setup code to an AsyncTask...I just figured it was too
> taxing on the system to do the set up in the main thread. So I decided
> to push that to a background thread while the rest of the activity
> loads.
>
> Thanks,
> DanielleM

-- 
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

Reply via email to