I am trying to combine images in view-pager with mp3 audio file.
I have 26 images of ABC alphabets in view-pager, and a ABC song in mp3 audio file. I want that when i click start button mp3 song file play and alphabets images in view-pager changes.
I had searched a lot but didn't find any solution that i can understand. Can some one give me code of that?
Please help me.
Thanks
I think the best way to solve your problem would be to create a timer and to simply switch between the bitmap at regular intervals.
When the start button is clicked, just launch the timer using an handler, and inside the timer event, add your logic to switch images.
Related
I'm really new to Android Studio, and am trying to make a simple app which plays specific sounds when a specific button is pressed. I have looked up many tutorials on YouTube, stack and other websites, but all of them seem to either give me a lot of errors or are too hard for me too understand (as I am too unexperienced).
All I have now are a lot of buttons on the screen which do nothing.
So can someone show me how to make something like this:
When button 1 is pressed, sound 1 plays, and when button 2 is pressed, sound 2 plays. (And that has to go on like that for about 20/30 buttons and sounds)
Thanks in advance,
-Spickle
Create a MediaPlayer mp object and use this in your onClick methods:
mp = MediaPlayer.create(context, R.raw.SoundForSpecificButton);
mp.start();
Then create a raw folder inside a res folder and put there your sounds.
Here is good documentation about this:
http://developer.android.com/guide/topics/media/mediaplayer.html#mediaplayer
If you are having problems please put your code here for review.
If you want to audio for a very short duration for example a 'click' sound when you press a button look for SoundPool class in android.
Play sound using soundpool example
If you want to stream a bigger audio file you will have to implement MediaPlayer.
I want to add custom audible feedback to a button press (various click sounds encoded as *.ogg) I've done this by using the RingtoneManager to create Ringtones for each of the clicks and then .play() them in the onClick() method. This works but seems a little sluggish. This leaves me wondering if there is a better way to attach a custom sound effect to a button press. I've scanned the Button reference page and all I found was playSoundEffect() which seems to handle only system defined sounds.
thanks,
hank
Use a SoundPool- they work it preloads the data into memory (so no file reads which cause sluggishness). Ringtones are definitely not what you want to be using here- those are typically much longer and not time critical (delaying a ringtone by a second or so isn't a problem, whereas delaying a button sound effect by that long is).
I want to create an app that records a sound. And while the app is recording the sound, I want an animation that looks just like in SoundHound or TrackID app.
I'm wondering what's the best and easiest way to do this? Is it using a Canvas, Animation-List, or GIFs?
Thanks
I think you should try ProgressWheel.
You can simply put another ImageView over this to display your custom image.
Edit
Another option I found is RaghavSood's AndroidCircularSeekBar
Advanced document is also there.
In my application I am displaying around 30 animal images using viewpager. each page has full screen image and play sound button. Clicking on button will play displayed animals sound. So there are 30 different sound files in raw folder. how to play audio effectively when user press button? What to use mediaplayer or soundpool? and how to use it effectively? Please give me solution.
Keep the song files in the raw folder and then on the button's onClick method execute the songs play.
You can use a switch case for different id's of button.
I want to play the audio file in my application but the condition is that I want to play the selected sound file in background that means when the Timer CountDown(I have created one separate View for the Timer CountDown) gets over the audio file should play with the Same Timer CountDown View as it is.
The Timer CountDown Layout View should be maintained and the audio file should be played.
Can anyone please help me here because I am able to play the selected file finely, but All I want to do is just to play it with the Timer CountDown View maintained.
How are you playing the audio file? With MediaPlayer you should be able to achieve what you want.
This question could also be helpful.