The dialog may become null after onDestroy has been invoked, so we need to catch this case. This CL also moves the listener outside to make it easy to test. Change-Id: I4ce640c5bdaf1f201f9fecb14b3e5e38e10d4b79 Fixes: 115679393 Test: RunSettingsRoboTests
Running Settings Robolectric tests
The full suite
$ croot
$ make RunSettingsRoboTests
Running a single test class
$ croot
$ make RunSettingsRoboTests ROBOTEST_FILTER=<ClassName>
For example:
make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
You can also use partial class name in ROBOTEST_FILTER. If the partial class name matches multiple file names, all of them will be executed.