开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜