Skip to content

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

@ceyeep

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".

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