Playing sound effect for button click

All your problems with Audio, Video and Images.

Playing sound effect for button click

Postby maduranga » Mon Oct 11, 2010 3:31 pm


I'm trying to use the
Code: Select all
playSoundEffect ()
method to play a sound effect when a button is clicked, but so far its' proved very difficult for some reason.

I have defined the following.
Code: Select all
    <ImageButton android:id="@+id/Button_flip" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="FLIP!"
    android:src="@drawable/flip" android:soundEffectsEnabled="true">


Code: Select all

is called in
Code: Select all
method. But I cannot seem to get it to sound when I click the button. What am I missing here? The documentation has nothing much to go on.

Do I need to define/call in the onClick() method or register to which event the sound should be played?

Any help is appreciated.

Thank you.
Posts: 8
Joined: Wed Sep 22, 2010 5:25 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 5 guests