Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.media.MediaPlayer;

public class Main {
    private static MediaPlayer mMediaPlayer;

    public static void playSound(Context context, int soundID) {
        mMediaPlayer = MediaPlayer.create(context, soundID);
        mMediaPlayer.setVolume(0.5f, 0.5f);
        mMediaPlayer.start();
    }
}