java - Is this an anonymous Object being returned Here? -
i going through android code on camera tutorial. come c#/obj-c/swift language set, java still new me. familiar functional programming syntax seeing not seem functional in nature (or maybe i'm wrong).
this code:
button.setonclicklistener ( new view.onclicklistener() { @override public void onclick(view v) { } } ); the line new view.onclicklistener() stuck on. onclicklistener interface. question this: is new view.onclicklistener() creating anonymous object has onclicklistener interface, , overriding onclickview?
p.s. if give me java name of 'type' code appreciate it.
as guessed, call new view.onclicklistener() {...} instantiates object of anonymous type implements view.onclicklistener. name of class determined name of surrounding class, , take form surroundingclass$index. if first anonymous inner class in myclass, called myclass$1.
Comments
Post a Comment