Android Anonymous Delegate
Coming from a .NET C# background, new to Java开发者_JAVA技巧....
How do I re-write this code to point the listener to a normal function?
confirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//Some Code Here;
}
});
Java follows a different concept than C#, it uses 'Anonymous Classes' for this approach. Maybe you should check out Java docs for it.
It is like implement a interface on the fly by a anonymous class.
精彩评论