Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Sound Pool Example in Android Development

Tags: android
This example shows how you can play sound using sound pool.
Algorithm:
1.) Create a new project by File-> New -> Android Project name it SoundPoolExample.
2.) Add a sound file to res/raw folder and name it to sound1.
3.) Write following into main.xml:
1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView android:text="Click on the screen to start playing"
        android:id="@+id/textView1" android:layout_width="fill_parent"
        android:layout_height="fill_parent"></TextView>
</LinearLayout>
4.) Run for output.
Steps:
1.) Create a project named SoundPoolExample and set the information as stated in the image.
Build Target: Android 4.0
Application Name: SoundPoolExample
Package Name: com. example. SoundPoolExample
Activity Name: SoundPoolExample
Min SDK Version: 8
2.) Open SoundPoolExample.java file and write following code there:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


This post first appeared on Android And Java Solution, please read the originial post: here

Share the post

Sound Pool Example in Android Development

×

Subscribe to Android And Java Solution

Get updates delivered right to your inbox!

Thank you for your subscription

×