Hi all, I learning Java as a second language. And I found some syntax in my book of android development to be very hard to explain. Would you help me with this example :

Button btn(Button)findViewById(R.id.btn_dialog);
btn.setOnClickListener(new View.OnClickListener(){
public void OnClick(View v) {
showDialog(0);
}
});

Its quite different from c++,you create View object and then you are calling OnclickListener or overloading it? I assume its overloading, but then it should go statments defining the method and here is another function with different name and that name it seams gets overloaded. Would you explain what's is really going on.
thank you

Edited 4 Years Ago by cppgangster: n/a

its an anonymous internal(inner) class, wikipedia didn't have a very helpful description for those but i think this article explains them pretty well, i didn't read it all but from the diagonal sampling i did it looks complete :P

anonymous inner class

Edited 4 Years Ago by Philippe.Lahaie: n/a

This question has already been answered. Start a new discussion instead.