View Single Post
  #1 (permalink)  
Old August 2nd, 2011, 06:09 PM
John Moore John Moore is offline
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Ch1 P.37 Code Mystery

protected Dialog onCreateDialog(int id) {
switch (id) {
case 0:
return new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)
.setTitle("This is a dialog with some simple text...");


The above code fragment has a syntax I do not recognize.
First, I always thought that a return statement immediately returns from the method.

I get the impression that the new AlertDialog.Builder Constructor returns an object that is then referenced. However, I see the .setIcon method and the .setTitle methods placed in a manner similar to the visual basic with statement.


Can someone explain what's going on?
Reply With Quote