Java tutorial
//package com.java2s; //License from project: Open Source License import android.database.Cursor; public class Main { /** * Close cursor if it's not <code>null</code>. * * @return <code>true</code> if closed, <code>false</code> if was <code>null</code> */ public static boolean closeSafely(Cursor cursor) { if (cursor == null) { return false; } else { cursor.close(); return true; } } }