protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Cursor albums = null; try { albums = getContentResolver().query( MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, null, null, null, null); } finally { if (albums != null) albums.close(); } } }