I want to use a delay but inside have a condition. Anything like that.
This method is the delay, inside when time is finish i call method responde(), but setText not work.
public void pensar(View v){
respuesta.setText("Ummmm");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
responde();
}
});
}
}, 1000);
}
Responde() method:
public void responde() {
if (sino == 1) {
respuesta.setText(R.string.yes);
} else if (sino == 2) {
respuesta.setText(R.string.no);
} else {
respuesta.setText(R.string.dontknow);
}
sino = 0;
}
The App is not crash, just not work.