- // Listen for clicks on entries in `listView`.
- listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- // Convert the `long` `id` to an `int`.
- int itemId = (int) id;
-
- // Only enable the click if it is not on the `currentPageId`.
- if (itemId != currentPageId) {
- // Get the history entry for this `itemId`.
- History historyEntry = historyArrayAdapter.getItem(itemId);
-
- // Remove the lint warning below that `historyEntry` might be `null`.
- assert historyEntry != null;
+ // Listen for clicks on entries in the list view.
+ listView.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
+ // Convert the long ID to an int.
+ int itemId = (int) id;