Java, Android my MediaPlayer API wouldn’t start

I’m a new programmer and I write a MediaPlayer API and the start() function wouldn’t work.

public class PlaySound {

    public Uri defaultAlarmAlertUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
    public int sound = R.raw.a;
    public static MediaPlayer mediaPlayer;
    private Context context;
    private Uri uri;
    int playSound;
    private Boolean playing;
    public PlaySound(Context context){
        this.context = context;
        playing = false;
        if(mediaPlayer != null){
            playing = mediaPlayer.isPlaying();
        }
        playSound = 0;

        uri = defaultAlarmAlertUri;
    }
    public PlaySound setSound(Uri uri){
        this.uri = uri;
        return this;
    }
    public PlaySound setSound(int uri){
        this.playSound = uri;
        return this;
    }
    public PlaySound start() {

        if (uri != null && playSound != 0) {
            mediaPlayer = MediaPlayer.create(context, uri);
        } else {
            mediaPlayer = MediaPlayer.create(context, playSound);
        }
        playing = true;
        mediaPlayer.stop();
        return this;
    }
    public Boolean isPlaying(){
        return playing;
    }
    public PlaySound stop(){
        if(mediaPlayer != null &&isPlaying()) {
            mediaPlayer.reset();
            mediaPlayer.stop();
        }
        return this;
    }
}

Answer

I found the errors.

public class PlaySound {

public Uri defaultAlarmAlertUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
public int sound = R.raw.a;
public static MediaPlayer mediaPlayer;
private Context context;
private Uri uri;
int playSound;
private Boolean playing;
public PlaySound(Context context){
    this.context = context;
    playing = false;
    if(mediaPlayer != null){
        playing = mediaPlayer.isPlaying();
    }
    playSound = 0;

    uri = defaultAlarmAlertUri;
}
public PlaySound setSound(Uri uri){
    this.uri = uri;
    return this;
}
public PlaySound setSound(int uri){
    this.playSound = uri;
    return this;
}
public PlaySound start() {

    if (uri != null && playSound == 0) {
        mediaPlayer = MediaPlayer.create(context, uri);
    } else {
        mediaPlayer = MediaPlayer.create(context, playSound);
    }
    playing = true;
    mediaPlayer.start();
    return this;
}
public Boolean isPlaying(){
    return playing;
}
public PlaySound stop(){
    if(mediaPlayer != null &&isPlaying()) {
        mediaPlayer.reset();
        mediaPlayer.stop();
    }
    return this;
}

}