I have bellow code which works just fine, but produces a warning:
method invocation 'cursor.close()' may produce 'java.lang.nullpointerexception'
cursor_id
may not be initialized, as, e.g., your try
block checks. You need to add the same validation in the finally
block:
} finally {
if (cursor_id != null) {
cursor_id.close();
}
}