код в основном классе работает идеально, но мне нужен другой поток, но там код не будет работать
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);
}
}
Ошибки:
The method create(Context, int) in the type MediaPlayer is not applicable for the arguments (Alarm, int)
и
The method getSystemService(String) is undefined for the type Alarm