What is the meaning of this .notation (AlertDialog.Builder) in a class constructor?
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.date_picker_title)
.setPositiveButton(android.R.string.ok, null)
.create();
}
Does it mean that the Builder class is defined inside the AlertDialog class? Or Builder is a method, but its first letter is capitalized so I'm confused.
This pattern is called method chaining.
Builder is a static inner class of AlertDialog.
Each method in Builder returns a Builder (usually "this") instead of void.
This means that Builder is a static nested class in AlertDialog class, that is
class AlertDialog {
static class Builder {
..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With