Simply a class that implements Runnable with constructor that accepts the parameter can do,
public class MyRunnable implements Runnable {
private Data data;
public MyRunnable(Data _data) {
this.data = _data;
}
@override
public void run() {
...
}
}
You can just create an instance of the Runnable class with parameterized constructor.
MyRunnable obj = new MyRunnable(data);
handler.post(obj);