@Override public void onPause() { super.onPause(); songDBIdsList.clear(); if (dbHelper != null) { dbHelper.close(); dbHelper = null; } if (isFinishing()) { if (SongsPickerFragment.cursor != null) { SongsPickerFragment.cursor.close(); SongsPickerFragment.cursor = null; } if (AlbumsPickerFragment.cursor != null) { AlbumsPickerFragment.cursor.close(); AlbumsPickerFragment.cursor = null; } if (ArtistsPickerFragment.cursor != null) { ArtistsPickerFragment.cursor.close(); ArtistsPickerFragment.cursor = null; } } }
public void createMusicLibrary() { // We're done with the database helper, so go ahead and close it. dbHelper.close(); dbHelper = null; // Launch the AsyncTask that will create the new music library. AsyncCreateMusicLibraryTask task = new AsyncCreateMusicLibraryTask(this, this, songDBIdsList, libraryName, libraryIconName); task.execute(); }