Hello!! the code in the main class works perfekt but i need a other thread but there the code won't work
public class Alarm implements Runnable {
@Override
public void run() {
MediaPlayer mp = new MediaPlayer().create(this, R.raw.alarm);
mp.start();
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long milliseconds = 1000;
v.vibrate(milliseconds);
}
}
Errors:
The method create(Context, int) in the type MediaPlayer is not applicable for the arguments (Alarm, int)
and
The method getSystemService(String) is undefined for the type Alarm