-
- // The private variables are used in `onCreate()` and `onCreateDialog()`.
- private String httpAuthHost;
- private String httpAuthRealm;
-
- public static HttpAuthenticationDialog displayDialog(String host, String realm) {
- // Store the strings in a `Bundle`.
- Bundle argumentsBundle = new Bundle();
- argumentsBundle.putString("Host", host);
- argumentsBundle.putString("Realm", realm);
-
- // Add `argumentsBundle` to this instance of `HttpAuthenticationDialog`.
- HttpAuthenticationDialog thisHttpAuthenticationDialog = new HttpAuthenticationDialog();
- thisHttpAuthenticationDialog.setArguments(argumentsBundle);
- return thisHttpAuthenticationDialog;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // Remove the incorrect lint warnings that `getString()` might be null.
- assert getArguments() != null;
-
- // Save the host and realm in class variables.
- httpAuthHost = getArguments().getString("Host");
- httpAuthRealm = getArguments().getString("Realm");
- }