I have mediaplayer in a class, but it doesn't work without a context. Can you help me with this problem?
package org.altervista.xsparter.www.app01;
import android.app.Activity;
import android.content.Context;
import android.media.MediaPlayer;
import android.os.Bundle;
public class actionview extends Activity {
private static Context context;
public static void setContext(Context mcontext) {
if (context == null)
context = mcontext;
}
public void getSound(String nota){
//Se la nota è docentrale
MediaPlayer mp1 = MediaPlayer.create(context, findViewById(context.getResources().getIdentifier(nota, "id", BuildConfig.APPLICATION_ID)));
}
}