Two different activities in a single activity - android

I am having one different requirement. I have an audio activity playing, in that I also have a map button that starts map activity. But what is to be taken care is the audio should be keep playing even when I am in map activity.
Can any body let me know the solution for this? I am breaking my head from days on this.
Thanks in advance,
Tejaswi

Your Audio should be played by a service in the background.No matter you are roaming in many activities.Your audio will be playing as it is

Related

Android: How to keep recording while switch between back and front camera?

Video is limited in 1 minute.
What I already try, I restart record after switch camera, so there are several video files, in the end, I append them one by one using mp4parser.
But in the final video, I get a up down video in the front camera part. I have no idea what's go wrong!
I have another thought is to record what I preview like record screen, but I have no idea how to implement it as First time camera player , like remove not needed UI.
If there is any advice would be great help. Thank your guys anyway
You can use jprofiler for performance monitoring and recording. I am using the same. Its amazing.

How to make a variable length sound in Android

I am trying to make an app that plays a sound like a piano organ. When the user presses a button it will play a piano-like sound. The difficulty is that the user could hold their finger down for any length of time. When they lift their finger off the should fade rather than stop abruptly.
I've played with SoundPool and Media Player but they don't seem suitable.
There are a lot of piano apps out there... does anyone know how they solve this problem?
You'll want to use the AudioTrack class. The basic usage is to write your sound data using AudioTrack's write() method for whatever duration that you want it to be heard. You'll need to use a separate thread for each simultaneous voice that you want to "play".
Here's the AudioTrack reference page and here's a blog entry where the author does a nice job of showing what to do without a lot of distractions.

Android Vine/Instagram style video recording

I am asking for some pointers or guidance on how to implement the video recording feature that vine and Instagram use on Android.
That is, when user tap and hold, the video start recording. When user release, the video recording pause, but when user tap and hold again, the video will continue recording until it reaches a limit of X second.
Thank you
I received same task several days ago. I would like to share my thoughts with you, I think You could record several files (MediaRecorder.start() / MediaRecorder.stop() will produce several video files) and combine them in one. For combine process MP4Parser looks nice.
Hope it helped you ;)

How do I stop the sound restarting when a collision occurs

Currently my code plays a sound when there is contact between any objects in my game using andEngine and Box2D and the walls, the problem I have is that when contact is made with any objects it starts again I understand why this is happening. What I want to do if possible is keep playing the sound while also playing it for another collision. I think I may need to use threads but I am unsure how to do this in java for android.
#Override
public void beginContact(Contact contact)
{
Rattle.this.mExplosionSound.play();
}
UPDATE: I don't seem to have been able to fix the issue but I know that what I need to do is play this sound multiple times simultaneously, I have tried threads and the soundPool but got no luck with either still not sure what to do.
It seems you have only one instance of the sound. Then you call play on the same sound twice, therefore it stops playing and starts from the beginning.
Imagine having one CD player - you press play, the music starts to play. You press play again and the player starts reading the track from the beginning. What you need is two players, therefore you may need two instances of the same sound.
(I don't have much experience with sound on Android so I may be wrong, please take the advice with a grain of salt.)
Even I was developing a game some time back and I found a similar problem. You should use SoundPool to play short sounds like crashing and collisions. here are some good linkswhich helped me. Link 1, link 2.

Android, How to Play song while i'm capturing video from camera?

when user clicks a button i nee to direct him to a page which it has list of songs. Then when an items selected by user the i need to play song and let him to capture movie together. Its something like karaoke.
Is it possible? please tell me how can i find a reference?
Thanks
Yes it is possible, I can tell because my cam playing button click sound when I am recording.
I don't think you need a service for that, just try using MediaPlayer
Use of service will help in this case. For this you need to create two services, one for recording video and other for playing music. Through your main activity control both.
I hope it solve the work. But as per the devices seen like samsung devices, they dont provide this functionality. When camera recording is done, you cant play music.
Logically using service we can do the task.
Let me know if it works :)

Categories

Resources