+ // The public interface is used to send information back to the parent activity.
+ public interface NavigateHistoryListener {
+ void navigateHistory(String url, int steps);
+ }
+
+ // The navigate history listener is used in `onAttach()` and `onCreateDialog()`.
+ private NavigateHistoryListener navigateHistoryListener;
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ // Run the default commands.
+ super.onAttach(context);
+
+ // Get a handle for the listener from the launching context.
+ navigateHistoryListener = (NavigateHistoryListener) context;
+ }
+