AlertDialog vs AlertDialog.Builder
问题 Why would one use the AlertDialog.Builder class rather than the methods directly available to AlertDialog , For example, why use AlertDialog.Builder.setCancellable rather than AlertDialog.setCancellable ? Surely this is a case of redundancy? 回答1: Because AlertDialog.setCancellable returns void and AlertDialog.Builder.setCancellable returns an AlertDialog.Builder . This means that the builder allows you to chain a bunch of settings with a little less verbosity. It's just a convenience class