I’m a little bit lost (maybe cause it’s late and friday :)).
I’ve created a class which has a public method “.addSaveClickListener(ClickListener listener)”. However, I need to let the user provide a “Button.ClickListener” and the class always needs to add some code to the user’s given sequence.
So the user of my class creates and instance and calls “.addSaveClickListener(new Button.ClickListener { …” and creates a buttonClick function from the interface. This function is filled with some code and I (always) need to extend this code by a line of myself.
What would be the best practice to achieve this?
thanks for your input! I guess that this is what I was looking for - so thank you
I’m a little bit lost in the line “(e) → r.run()” how would I do this with Java 7?
My current state is:
Runnable r_closer = new Runnable() {
@Override
public void run() {
System.out.println("This works");
}
};
//getB_save is a button (listener is the argument for the method)
this.getB_save().addClickListener(listener);