- // The public interface is used to send information back to the parent activity.
- public interface UrlHistoryListener {
- // Send back the number of steps to move forward or back.
- void onUrlHistoryEntrySelected(int moveBackOrForwardSteps);
-
- // Clear the history.
- void onClearHistory();
- }
-
- // `urlHistoryListener` is used in `onAttach()` and `onCreateDialog()`.
- private UrlHistoryListener urlHistoryListener;
-
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
-
- // Check to make sure tha the parent activity implements the listener.
- try {
- urlHistoryListener = (UrlHistoryListener) context;
- } catch (ClassCastException exception) {
- throw new ClassCastException(context.toString() + " must implement UrlHistoryListener.");
- }
- }
-