0
My app has a ImagemView
and I’m trying to make him blink.
This method keeps repeating for 6 seconds.
@Override
public void onSensorChanged(SensorEvent event) {
verificarAndamento();
if(emCaputura){
Log.e("Tempo" , ""+tempoDecorrido);
if(tempoDecorrido % 1000==0){
imagem.setVisibility(View.INVISIBLE);
//Toast.makeText(this, "1000", Toast.LENGTH_SHORT).show();
}else if(tempoDecorrido % 500==0){
imagem.setVisibility(View.VISIBLE);
//Toast.makeText(this, "500", Toast.LENGTH_SHORT).show();
}//Jeito que tentei fazer repedir
synchronized (this) {
long current_time = event.timestamp;
curX = event.values[0];
curY = event.values[1];
curZ = event.values[2];
if (prevX == 0 && prevY == 0 && prevZ == 0) {
last_update = current_time;
last_movement = current_time;
prevX = curX;
prevY = curY;
prevZ = curZ;
}
long time_difference = current_time - last_update;
if (time_difference > 0) {
float movement = Math.abs((curX + curY + curZ) - (prevX - prevY - prevZ)) / time_difference;
int limit = 1500;
float min_movement = 1E-6f;
if (movement > min_movement) {
if (current_time - last_movement >= limit) {
movements.add(movement);
}
last_movement = current_time;
}
prevX = curX;
prevY = curY;
prevZ = curZ;
last_update = current_time;
}
}
}
}
I want the image to flash while the method is running.
This "fear"?!?!?!
– Maniero
was supposed to be methodical
– Ilgner de Oliveira