Android Open Source - GNE_Nepal_App Sound Module






From Project

Back to project page GNE_Nepal_App.

License

The source code is released under:

GNU General Public License

If you think the Android project GNE_Nepal_App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.yadaming.gne_nepal_app;
/*from w w  w.  ja va 2 s. c om*/
import android.content.Context;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;

public class SoundModule {
    Context c;
    public static boolean playing;

    // create a private MediaPlayer instance
    private static MediaPlayer mMediaPlayer;

    public SoundModule(Context context) {
        c = context;
    }

    public void play(int soundToPlay) {
        playing = true;
        //MediaPlayer mMediaPlayer = MediaPlayer.create(c, soundToPlay);
        mMediaPlayer = MediaPlayer.create(c, soundToPlay);
        mMediaPlayer.start();
        mMediaPlayer.setOnCompletionListener(new OnCompletionListener() {

            @Override
            public void onCompletion(MediaPlayer mp) {
                playing = false;
            }
        });
    }

    public boolean playsound(int soundToPlay) {
        playing = true;
        //MediaPlayer mMediaPlayer = MediaPlayer.create(c, soundToPlay);
        mMediaPlayer = MediaPlayer.create(c, soundToPlay);
        mMediaPlayer.start();
        mMediaPlayer.setOnCompletionListener(new OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                playing = false;
            }
        });
        return true;
    }

    public void stop(int soundToPlay)
    {
        mMediaPlayer.stop();
        playing = false;
    }

}




Java Source Code List

com.yadaming.gne_nepal_app.Alcohol.java
com.yadaming.gne_nepal_app.Calcium.java
com.yadaming.gne_nepal_app.Cooking.java
com.yadaming.gne_nepal_app.End.java
com.yadaming.gne_nepal_app.Folate.java
com.yadaming.gne_nepal_app.Hand.java
com.yadaming.gne_nepal_app.Hygiene.java
com.yadaming.gne_nepal_app.InitialActivity.java
com.yadaming.gne_nepal_app.Iodine.java
com.yadaming.gne_nepal_app.Iron.java
com.yadaming.gne_nepal_app.Rice_main_circled.java
com.yadaming.gne_nepal_app.Rice_none_circled.java
com.yadaming.gne_nepal_app.Rice_right_circled.java
com.yadaming.gne_nepal_app.ScoreKeeper.java
com.yadaming.gne_nepal_app.Slide12Activity.java
com.yadaming.gne_nepal_app.Slide14Activity.java
com.yadaming.gne_nepal_app.Slide15Activity.java
com.yadaming.gne_nepal_app.Slide16Activity.java
com.yadaming.gne_nepal_app.Slide17Activity.java
com.yadaming.gne_nepal_app.Slide18Activity.java
com.yadaming.gne_nepal_app.Slide19Activity.java
com.yadaming.gne_nepal_app.Slide20Activity.java
com.yadaming.gne_nepal_app.Slide22Activity.java
com.yadaming.gne_nepal_app.Slide24Activity.java
com.yadaming.gne_nepal_app.Slide25Activity.java
com.yadaming.gne_nepal_app.Slide26Activity.java
com.yadaming.gne_nepal_app.Slide27Activity.java
com.yadaming.gne_nepal_app.Slide28Activity.java
com.yadaming.gne_nepal_app.Slide29Activity.java
com.yadaming.gne_nepal_app.Slide2Activity.java
com.yadaming.gne_nepal_app.Slide30Activity.java
com.yadaming.gne_nepal_app.Slide3Activity.java
com.yadaming.gne_nepal_app.Slide4Activity.java
com.yadaming.gne_nepal_app.Slide5Activity.java
com.yadaming.gne_nepal_app.Slide6Activity.java
com.yadaming.gne_nepal_app.Slide7Activity.java
com.yadaming.gne_nepal_app.Slide8Activity.java
com.yadaming.gne_nepal_app.SnackFoodActivity.java
com.yadaming.gne_nepal_app.SoundModule.java
com.yadaming.gne_nepal_app.VitaminA.java
com.yadaming.gne_nepal_app.Vitamin.java
com.yadaming.gne_nepal_app.WhyBeNutritious.java
com.yadaming.gne_nepal_app.fileIO.java
com.yadaming.gne_nepal_app.testActivity.java