I am new to ANDROID DEVELOPMENT. I learnt java before jumping in to Android. I see this code in a book and I am stumped. How does this even work?
I get the part that the setbutton method of progressDialog class is receiving parameters.
But the 3rd parameter is a class? I though new keyword is used to create a new type (a class). how is that a method (.OnClickListener) is being referenced when the class is being created on top of all, there is another method(onClick) being created inside it. Obviously, there is something in java I am not aware of. Can someone tell me if there is a tutorial on this concept in java? I am not worried about a button being created and being clicked on. I am talking about the concept of this programming used in here.
Thank you so much.
progressDialog.setButton(DialogInterface.BUTTON_POSITIVE, “OK”,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int whichButton)
{
Toast.makeText(getBaseContext(),“OK clicked!”,
Toast.LENGTH_SHORT).show();
}
});