Implement the same music in two android activities - android

I'm currently developing android app using eclipse. Basicaly I want to make two activities play the same music without re-playing. Anyone know how to do that?

I am not sure, but you could create some static MediaPlayer object that would be shared across two activites.
Also you could look at Service that would could be bind to any of those activites and would start playback and play without depending on Activites.

Related

How to organize an audio analyzer application - activities, sound analysis?

I have an Audio analyzer app that was exported from processing.org to Android.
It works, but it's not organized properly to extend its functionalities. Therefore, I'd like to start coding proper Android app with activities and everything needed from scratch and include existing code where needed.
But I have a problem, how to organize such app in proper Android way.
Quick description of app :
- app captures sound from microphone in frames and calculates magnitude spectrum of the frame
- app supports 3 possible graphs (time-domain, spectrum and spectrogram)
- app has 4 screens - fist screen displays all 3 smaller graphs and then user can touch each graph to get into separate screen with bigger screen
I get that those screens are probably separate activities under Android (4 of them), but I'm not sure how to use audio capture and analysis code that is basically active in background and serves data to be displayed to all activities ?
If you can give me an advice or pointer to some similar examples where I can learn about it.
Thanks in advance,
regards,
Rob.
Hello)I suppose that the best practice to organize such structure will be one activity and fragments inside of them.
For instance: one FragmentActivity hosts your fragments and displays them together. When you press on your layouts with fragments - you go for details to another fullscreen fragment.
To use background process you have to implement services - just like in any music app. About communication of services with activities you can real below:
https://developer.android.com/guide/components/services.html
Here you can read about fragments:
https://developer.android.com/guide/components/fragments.html

Is it possible to embed an Android app in a pre-existing app?

I would like to inquire if it is possible to embed an Android app in a pre-existing app?
Basically, the parent app will have a set of tabs. Clicking on each tab will open a third-party app within the tab activity. I will access to the third party's apk files but not their source code.
Please advice if this is possible in Android or not.
You don't need to embed the applications, but you can use startActivity or startActivityForResult to launch other applications.
No you can't embed activities in other activities. You can use fragments to do the same thing, but it sounds like that's not what you want.

Android:Stop or mute the mediaplayer but for all activities

I am developing a Quiz game application which is being developed completely but at various activities of my game different type of sounds files are played on every correct and wrong answer and respective theme sounds also plays at background.
But the problem arises when i want to stop or mute and start all the instances of media player running in various activities on click of mute and sound button in launcher activity.Can anyone help me out to bring out a logic of achieving this.I have dig into the logic a lot but cant find any concept to achieve this thats why no code to show.Because its totally logic based.
You can use a global class that contains "static" mediaplayer(s). When you need to stop, start or pause a mediaplayer, you can use
Global.mp1.stop();
Global.mp2.pause();
Global.mp3.start();
etc.

Showing a common music player in all activities

I'm working on an app for a band, which consists of several different activities such as an agenda, news section, album section et cetera.
Since it's for a band, I would like to play the band's songs in the background.
This isn't such a problem, but I would like to show a small music player on the bottom of all activities so users can always stop, skip, or replay a song if they want to. An example of this can be found in the apps of Mobile Roadie, for instance.
However I have no idea how to do this. My best guess is creating a music player class with its own layout, and including this at the bottom of each activity/layout. But since every activity starts in its own thread, I'm guessing this would reset the player for each activity.
So, how would I go about adding a common music player to all of my activities, where the state of the music player would be maintained?
For an example, download any of the music based apps of Mobile Roadie and you'll know what I mean.
I decided on using Fragments, but I'm not sure if I can use those in already existing activities. All the examples I found focus on completely new projects, and not already existing ones.
So in short, can you create fragments and use them in already existing activities? (such as showing the music player on top of the existing agenda activity)
I suggest you doing it the following way. Since music playing state must be retained in all the activities, you have to use a service to achieve this. Also you need a control panel, which must exist separately from activities. The best method to do it is by using fragments. Create a fragment which connects to the service and provides an UI to control it, then add this fragment to all the activities where you need it.

Is it possible to run (and view) two apps simultaneously?

I have some questions about android development.
I have googled around, but cannot seem to find any answers to my questions.
Is it possible to display google maps in a widget?
Is it possible to run (and view) two apps simultaneously?
Is it possible to run an App within an App?
Is it possible to display google maps in a widget?
Yes
Is it possible to run (and view) two apps simultaneously? No
Is it possible to run an App within an App? You can launch an app, from another app. But you can't run an app inside another. Well... you could try playing with an ActivityGroup and get a View reference of the inner app you want to run, and then render that View... but I think it is nonsense

Categories

Resources