J'ai une minuterie dans mon programme Android:paramètre dans runOnUiThread
timer1= new Timer();
timer1.schedule(new TimerTask() {
@Override
public void run() {
TimerMethod();
}
}, 0, 3000);
private void TimerMethod()
{
this.runOnUiThread(Timer_Tick);
}
private Runnable Timer_Tick = new Runnable() {
public void run() {
//my code
}}
Je veux envoyer un paramètre à Timer_Tick de TimerMethod, dans un autre mot que je veux un paramètre d'entrée pour Timer_Tick,
J'ai changé mon code à:
int input1=10;
timer1= new Timer();
timer1.schedule(new TimerTask() {
@Override
public void run() {
TimerMethod(input1);
}
}, 0, 3000);
private void TimerMethod(int myinput)
{
this.runOnUiThread(Timer_Tick);
//How pass myinput to Timer_Tick????????????
}
que dois-je faire?
Quel est le problème en l'ajoutant alors? –
http://stackoverflow.com/questions/7761723/android-howto-pass-data-to-the-runnable-in-runonuithread – sasikumar