soulreaver1
Lurker
At first i'm a beginner (completely) to an android development, so please forgive me my noob questions.
I have a problem with understanding this sample code below. I can't manage out what is happening in a alert.setPositiveButton arguments section. DialogInterface.OnClickListener() is an interface so what a "new" word in a front of it stands for? Please try to explain this to me step by step.
I have a problem with understanding this sample code below. I can't manage out what is happening in a alert.setPositiveButton arguments section. DialogInterface.OnClickListener() is an interface so what a "new" word in a front of it stands for? Please try to explain this to me step by step.
Code:
public void aalert() {
AlertDialog.Builder alert = new AlertDialog.Builder(DisplayMessageActivity.this);
alert.setTitle("Are u ok?");
alert.setMessage("?");
alert.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Toast.makeText(DisplayMessageActivity.this, "Success", Toast.LENGTH_SHORT).show();
}
});
alert.show();
}