Is there any predefined sound on android? - android

I'm wondering, if there is any predefined sounds in Android that I can use in my application.
I was trying to use a class called SoundManager which is build specifically for sound playing in an efficient way.
I realized that what I need is much much smaller than this class. I need a click sound when the button is clicked and a navigation sound when the user navigate through a menu or a set of buttons.
I guess there is something in the android API fit to my purpose but I could not find it.
any help please in finding it and hoe to use it?

You could look into the View.playSoundEffect api. This method accepts a SoundEffectConstants value where, among others, a CLICK constant is available.

Using the MediaPlayer it's really simple, see for instance this SO thread:
Android - play sound on button click - Null pointer exception

Related

How to implement Floating type MediaPlayer similar to Samsung Tab10.0

I am working on a project where i want to implement mediaplayer as docked/Floating type similar to Gallary mediaPlayer of Samsung.
i was thinking of the following views/widgets but could not decide which would be helpful:
popupwindow
Android widget.
viewDragghelper.
Please suggest what to be used so that player continues to play even when we exits the application.
Here i attach a snapshot for reference.
If you need something that can persists playing after you leave your main activity, than you need to create your View hierarchy and attach it to a Window (like chat-heads does), using a Service as context.
You can find a working example here.

android audio - generating a simple customizable bell/gong sound

I am writing a countdown timer for android right now and I want to give the user the possibility to customize the sound used for it. Rather than offering a set of fixed sounds i would prefer to give the user some settings in the hand with which the sound can be customized (and the app generates the sound based on the user settings). I would like a basic bell/gong type of sound, nothing fancy.
I found libraries like jass which offer this kind of audio generation yet i havent found something which i can use for android.
It would be great if somebody could give me some ideas in which direction to look.

Android App - mediaplayer always available

this is my first post on stack overflow so hoping you can help.
We are developing an Android App, that requires an audio player to always be available, no matter what activity you are on. Ideally, we want this to be a "pop up" style player that is accessible when you tap the screen or tab an always visible button (e.g. on the action bar). However, the player needs to overlay the activity you are on, and continue playing the audio as you move between activities and (ideally) multi task within your device.
I have looked into various options for this, and wonder if a service is the best way to go. The other option I am considering is a transarent activity. But I am open to suggestions!
Can anyone offer any guidance? Thanks in advance.
I think that service, playing the tracks is the best way to go.
For the player visual interface, you should have one view, which will be included wherever you need it.
When you open this view, you will get the information from the service (what track are you on, where exactly in the track) and initialize with those results.
At least this is my suggestion approach to the task. Good luck!
Have tried considering making it an android widget? It remains on the home screen and user can play music and get back to other tasks.
But not sure if it will meet your overlay criteria(Which I quite didn't understand.. :))
Check out Androids MediaPlayer-Class. This should prevent you with all nessesary playback functions. On how to create your player-controll-interface on Androids Action-Bar, check Googles Tutorial. But note that the ActionBar is available since Android 3.0, not in previous version!

How can you manually reorder a ListView in Android?

I have a ListView in Android that needs to have the ability to be manually reordered. An example would be within Android's Music Player application, when you can change the order of tracks in a playlist. I know how to programmatically change the order of a ListView, but not how to do it in regards to a touch and slide approach that can be found in the Music Player application.
Thanks in advance,
groomsy.
There's nothing in the framework for this at the moment, you'll need to look at the Music source code to get an idea of how to implement this. You can also, of course, copy over parts of the relevant implementation as you see fit.

Android: Looking for an easy way to play notification sounds in a loop manually

I am fiddling around with a dialog that pops up and displays an alarm information. (I know, it has been documented that in Android it's "better" style to use notifications instead, but just like the alarm clock I want it to display a dialog on top of whatever you do to really get the users immediate attention - as the user expects this behavior I don't think it's bad style!)
Now - the only easy way I found is using the RingtoneManager.getRingtone() function to get a Ringtone object for the type "alarm".
Well, I can play that sound now using Ringtone.play() - but it plays the sound only once and I cannot figure out how to let it play endlessly until the user reacts, e.g. by touching the dialog anywhere or dismissing it using Cancel button provided.
Does anyone know how this can be accomplished easily?
Thanks!
Take a look at AlarmClock from Android's git repository. It might be helpful to check out the source code on how to play sounds for an expected duration.

Categories

Resources