I am novice programming. I have a Handler like this:
private static final Handler handler = new Handler() {
public void handleMessage(Message msg) {
int current = msg.arg1;
text.setText(current+ " steps");
double recorrido;
recorrido= current*0.70;
DecimalFormat df = new DecimalFormat("###.#");
String distancia_recorrida = String.valueOf(df.format(recorrido));
distancia.setText(distance);
if(recorrido>100){
distancia.setText("Fin");
vibrate();
}
}
};
My vibrate method is this:
protected static void vibrar() {
// TODO Auto-generated method stub
Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE) ;
vibe.vibrate(1000);
}
But I have an issue because it says that "Cannot make a static reference to the non-static method getSystemService(String) from the type Activity", how can I solve it? Thank you