I have a timer in my android program:
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
}}
I want to send a parameter to Timer_Tick from TimerMethod , in other word I want an input parameter for Timer_Tick ,
I changed my code to:
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????????????
}
what should I do?