Skip to content

Exception after calling onDestroy() method in DrinkCategoryActivity.java in Chapter 12 #11

Description

@ceyeep

A NullPointerException may occur in DrinkCategoryActivity.java from Chapter 12 after calling the onDestroy() method if "cursor" or "db" objects are null (e.g., after rotating the device when having the Drink Categories list on screen).

@Override public void onDestroy() { super.onDestroy(); cursor.close(); db.close(); }

Need to do a null check on variables "cursor" and "db".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions