The answer to both problems is most likely going to be using background services... So, I would start by looking here:
http://developer.android.com/guide/topics/fundamentals/services.html Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Jun 19, 2012 at 8:49 AM, Shino <shinobi...@gmail.com> wrote: > Hello. I'm new here and new to Android Development. > I'm working on my first app and it was coming along really well until I > ran into a couple of road blocks that I'm not sure what to do with. > I've done a lot of searching without any luck and I've posted questions on > StackOverflow but they have not been answered. I will reference them in > the post. > > First, I'm developing for 2.2. I am not against developing for 2.3 if > that may solve my issues. > > The first one is that I have 2 spots in the app where I would like to > launch the device's default music player and play a file (one form storage > and one streamed from an internet location). And that works fine, but as > soon as I hit back or home to try and get back to my app, the music player > closes and the playback stops. I did notice that if I brought down the > notification pane and clicked on the notification that is created, then hit > back, it would continue to play in the background. But having to go there > each time just to keep it playing is a hassle for the user. Is there > anyway to launch it in the background and have it keep playing. I tried > starting the activity in an AsyncTask too and the same thing happens > (Default music player shows up to the user and finishes when hitting back > or home). > More info: > > http://stackoverflow.com/questions/11040497/can-you-start-the-default-music-player-in-the-background > > The second issue is that I have an AsyncTask that downloads the file in > the background and creates a notification. When the user clicks on the > notification, the Activity that goes off from the PendingIntent displays a > dialog asking if they want to stop the download (if it's not already > complete). Problem here is I'm not sure how to let the AsyncTask know that > the task should be canceled. How do I access the AsyncTask from the > Activity that creates the Dialog? > More info: > > http://stackoverflow.com/questions/11001723/android-how-do-i-access-an-asynctask-from-a-pendingintent-created-by-a-status-b > > Any assistance would be greatly appreciated. > These are the last 2 kinks I have to work out and I've been trying to get > them figured out for over a week now. I feel like I'm missing some easy > solution to both. > > Thanks in advance. > > > > -- > 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+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en