AlertDialog vs AlertDialog.Builder

android, android-alertdialog

Solution

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

Problem

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?

Original source