- // Get a handle for `AddDomainListener` from `context`.
- try {
- addDomainListener = (AddDomainListener) context;
- } catch(ClassCastException exception) {
- throw new ClassCastException(context.toString() + " must implement `AddDomainListener`.");
- }
+ // Get a handle for the listener from the launching context.
+ addDomainListener = (AddDomainListener) context;
+ }
+
+ public static AddDomainDialog addDomain(String url) {
+ // Create an arguments bundle.
+ Bundle argumentsBundle = new Bundle();
+
+ // Store the URL in the bundle.
+ argumentsBundle.putString("url", url);
+
+ // Create a new instance of the dialog.
+ AddDomainDialog addDomainDialog = new AddDomainDialog();
+
+ // Add the bundle to the dialog.
+ addDomainDialog.setArguments(argumentsBundle);
+
+ // Return the new dialog.
+ return addDomainDialog;