android.database.sqlite.SQLiteException Java Examples
The following examples show how to use
android.database.sqlite.SQLiteException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DBAdapter.java From clevertap-android-sdk with MIT License | 6 votes |
synchronized long getLastUninstallTimestamp(){ final String tName = Table.UNINSTALL_TS.getName(); Cursor cursor = null; long timestamp = 0; try { final SQLiteDatabase db = dbHelper.getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM " + tName + " ORDER BY " + KEY_CREATED_AT + " DESC LIMIT 1",null); if(cursor!=null && cursor.moveToFirst()){ timestamp = cursor.getLong(cursor.getColumnIndex(KEY_CREATED_AT)); } }catch (final SQLiteException e) { getConfigLogger().verbose("Could not fetch records out of database " + tName + ".", e); } finally { dbHelper.close(); if (cursor != null) { cursor.close(); } } return timestamp; }
Example #2
Source File: SettingsFragment.java From android_gisapp with GNU General Public License v3.0 | 6 votes |
protected static void deleteLayers(Activity activity) { MainApplication app = (MainApplication) activity.getApplication(); for (int i = app.getMap().getLayerCount() - 1; i >= 0; i--) { ILayer layer = app.getMap().getLayer(i); if (!layer.getPath().getName().equals(MainApplication.LAYER_OSM) && !layer.getPath() .getName() .equals(MainApplication.LAYER_A) && !layer.getPath() .getName() .equals(MainApplication.LAYER_B) && !layer.getPath() .getName() .equals(MainApplication.LAYER_C) && !layer.getPath() .getName() .equals(MainApplication.LAYER_TRACKS)) { layer.delete(); } } try { ((MapContentProviderHelper) MapBase.getInstance()).getDatabase(false).execSQL("VACUUM"); } catch (SQLiteException e) { e.printStackTrace(); } }
Example #3
Source File: DatabaseHelper.java From Instagram-Profile-Downloader with MIT License | 6 votes |
public void insertIntoDb(String username, Bitmap image){ SQLiteDatabase db = this.getWritableDatabase(); if(hasObject(username, DB_TABLE)) deleteRow(username, DB_TABLE); try { ContentValues contentValues = new ContentValues(); contentValues.put(USERNAME, username); contentValues.put(IMAGE_THUMBNAIL, ZoomstaUtil.getBytes(image)); db.insert(DB_TABLE, null, contentValues); db.close(); } catch (SQLiteException e){ e.printStackTrace(); } }
Example #4
Source File: LoadTagsTask.java From lbry-android with MIT License | 6 votes |
protected List<Tag> doInBackground(Void... params) { List<Tag> tags = null; SQLiteDatabase db = null; try { if (context instanceof MainActivity) { db = ((MainActivity) context).getDbHelper().getReadableDatabase(); if (db != null) { tags = DatabaseHelper.getTags(db); } } } catch (SQLiteException ex) { error = ex; } return tags; }
Example #5
Source File: SubscriptionsDbHelper.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
private ArrayList<Integer> getUsersNotToNotify(SQLiteDatabase db) throws SQLiteException { String query = "SELECT * FROM " + SubscriptionsDbHelper.TABLE_NAME + " WHERE " + SubscriptionsDbHelper.COLUMN_NOTIFY_WHEN_LIVE + "=" + 0 + ";"; Cursor cursor = db.rawQuery(query, null); ArrayList<Integer> usersToNotify = new ArrayList<>(); while(cursor.moveToNext()) { int idPosition = cursor.getColumnIndex(SubscriptionsDbHelper.COLUMN_ID); int userId = cursor.getInt(idPosition); usersToNotify.add(userId); } cursor.close(); return usersToNotify; }
Example #6
Source File: ChannelBaseFragment.java From letv with Apache License 2.0 | 6 votes |
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (cursor != null) { Set<String> mBookedPrograms = new HashSet(); while (cursor.moveToNext()) { try { int idx = cursor.getColumnIndexOrThrow(Field.MD5_ID); if (idx != -1) { mBookedPrograms.add(cursor.getString(idx)); } } catch (SQLiteException e) { e.printStackTrace(); return; } } if ((getAdapter() instanceof ChannelDetailExpandableListAdapter) && getAdapter().getChannelLivehallView() != null) { getAdapter().getChannelLivehallView().setBookedPrograms(mBookedPrograms); } } }
Example #7
Source File: HistoryManager.java From barcodescanner-lib-aar with MIT License | 6 votes |
public void trimHistory() { SQLiteOpenHelper helper = new DBHelper(activity); SQLiteDatabase db = null; Cursor cursor = null; try { db = helper.getWritableDatabase(); cursor = db.query(DBHelper.TABLE_NAME, ID_COL_PROJECTION, null, null, null, null, DBHelper.TIMESTAMP_COL + " DESC"); cursor.move(MAX_ITEMS); while (cursor.moveToNext()) { String id = cursor.getString(0); Log.i(TAG, "Deleting scan history ID " + id); db.delete(DBHelper.TABLE_NAME, DBHelper.ID_COL + '=' + id, null); } } catch (SQLiteException sqle) { // We're seeing an error here when called in CaptureActivity.onCreate() in rare cases // and don't understand it. First theory is that it's transient so can be safely ignored. Log.w(TAG, sqle); // continue } finally { close(cursor, db); } }
Example #8
Source File: SQLiteClientManager.java From DeviceConnect-Android with MIT License | 6 votes |
/** * サービスIDをキーにDB検索し該当するクライアントを返す. * @param serviceId サービスID * @return not null: サービスIDが一致するクライアント / null: サービスIDが一致するクライアント無し */ public Client findByServiceId(final String serviceId) { if (mDb != null) { Bundle where = new Bundle(); where.putString(SQLiteClient.DATA_TYPE_STRING + "," + SQLiteClient.DEVICEID_FIELD, serviceId); Client[] clients = dbLoadClients(mDb, where); if (clients == null || clients.length == 0) { return null; } else if (clients.length == 1) { return clients[0]; } else { throw new SQLiteException("クライアントIDが2件以上のクライアントデータに設定されています。"); } } else { throw new SQLiteException("DBがオープンされていません。"); } }
Example #9
Source File: NGWVectorLayer.java From android_maplib with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void fromJSON(JSONObject jsonObject) throws JSONException, SQLiteException { super.fromJSON(jsonObject); mTracked = jsonObject.optBoolean(JSON_TRACKED_KEY); mCRS = jsonObject.optInt(GeoConstants.GEOJSON_CRS, GeoConstants.CRS_WEB_MERCATOR); if (jsonObject.has(JSON_NGW_VERSION_MAJOR_KEY)) { mNgwVersionMajor = jsonObject.getInt(JSON_NGW_VERSION_MAJOR_KEY); } if (jsonObject.has(JSON_NGW_VERSION_MINOR_KEY)) { mNgwVersionMinor = jsonObject.getInt(JSON_NGW_VERSION_MINOR_KEY); } setAccountName(jsonObject.optString(JSON_ACCOUNT_KEY)); mRemoteId = jsonObject.optLong(Constants.JSON_ID_KEY); mSyncType = jsonObject.optInt(JSON_SYNC_TYPE_KEY, Constants.SYNC_NONE); mNGWLayerType = jsonObject.optInt(JSON_NGWLAYER_TYPE_KEY, Constants.LAYERTYPE_NGW_VECTOR); mServerWhere = jsonObject.optString(JSON_SERVERWHERE_KEY); mSyncDirection = jsonObject.optInt(JSON_SYNC_DIRECTION_KEY, DIRECTION_BOTH); }
Example #10
Source File: Whassup.java From whassup with Apache License 2.0 | 6 votes |
private Cursor getCursorFromDB(final File dbFile, long since, int max) throws IOException { Log.d(TAG, "using DB "+dbFile); SQLiteDatabase db = getSqLiteDatabase(dbFile); String limit = null; String selection = null; String[] selectionArgs = null; if (since > 0) { selection = String.format("%s > ?", TIMESTAMP); selectionArgs = new String[]{String.valueOf(since)}; } if (max > 0) { limit = String.valueOf(max); } final String orderBy = TIMESTAMP + " ASC"; try { return db.query(WhatsAppMessage.TABLE, null, selection, selectionArgs, null, null, orderBy, limit); } catch (SQLiteException e) { Log.w(TAG, "error querying DB", e); throw new IOException("Error querying DB: "+e.getMessage()); } }
Example #11
Source File: StormTest.java From Storm with Apache License 2.0 | 6 votes |
@Nullable DatabaseManager open() { final BuildConfig.ORM orm = getORM(); final DatabaseManager manager = new DatabaseManager( getContext(), orm.getDbName(), orm.getDbVersion(), new Class[]{ StormObject.class } ); try { manager.open(); } catch (SQLiteException e) { Debug.e(e); return null; } return manager; }
Example #12
Source File: SQLiteProfile.java From DeviceConnect-Android with MIT License | 6 votes |
/** * profilesテーブルの新規レコードで本データを追加しIDを取得する. * * @param db データベース */ public void dbInsert(final SQLiteDatabase db) { ContentValues values = new ContentValues(); values.put(PROFILE_NAME_FIELD, mProfileName); values.put(DESCRIPTION_FIELD, mDescription); long profileId = -1; try { profileId = db.insert(LocalOAuthOpenHelper.PROFILES_TABLE, null, values); } catch (SQLiteException e) { throw e; } if (profileId < 0) { throw new SQLiteException("SQLiteException - insert error."); } this.mId = profileId; }
Example #13
Source File: TrackerService.java From android_maplibui with GNU Lesser General Public License v3.0 | 6 votes |
private void startTrack() { // get track name date unique appendix String pattern = "yyyy-MM-dd--HH-mm-ss"; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // insert DB row final long started = System.currentTimeMillis(); String mTrackName = simpleDateFormat.format(started); mValues.clear(); mValues.put(TrackLayer.FIELD_NAME, mTrackName); mValues.put(TrackLayer.FIELD_START, started); mValues.put(TrackLayer.FIELD_VISIBLE, true); try { Uri newTrack = getContentResolver().insert(mContentUriTracks, mValues); if (null != newTrack) { // save vars mTrackId = newTrack.getLastPathSegment(); mSharedPreferencesTemp.edit().putString(TRACK_URI, newTrack.toString()).apply(); } mIsRunning = true; addSplitter(); } catch (SQLiteException ignored) { } }
Example #14
Source File: SQLiteTokenManager.java From DeviceConnect-Android with MIT License | 6 votes |
/** * クライアントIDとユーザー名が一致するトークンを取得する. * * @param client クライアントID * @param username ユーザー名 * @return トークン(該当なければnullを返す) * */ public Token findToken(final Client client, final String username) { if (mDb != null) { String selection = SQLiteToken.CLIENTID_FIELD + "=? and " + SQLiteToken.USERS_USERID_FIELD + "=?"; String[] selectionArgs = { client.getClientId(), String.valueOf(LocalOAuthOpenHelper.USERS_USER_ID) }; SQLiteToken[] tokens = dbLoadTokens(mDb, selection, selectionArgs); if (tokens == null) { return null; } else if (tokens.length == 1) { return tokens[0]; } else { throw new SQLiteException("アクセストークンに該当するトークンが2件以上存在しています。"); } } else { throw new SQLiteException("DBがオープンされていません。"); } }
Example #15
Source File: DBAdapter.java From clevertap-android-sdk with MIT License | 6 votes |
/** * Deletes the inbox message for given messageId * @param messageId String messageId * @return boolean value based on success of operation */ @SuppressWarnings("UnusedReturnValue") synchronized boolean deleteMessageForId(String messageId, String userId){ if(messageId == null || userId == null) return false; final String tName = Table.INBOX_MESSAGES.getName(); try { final SQLiteDatabase db = dbHelper.getWritableDatabase(); db.delete(tName, _ID + " = ? AND " + USER_ID + " = ?", new String[]{messageId,userId}); return true; } catch (final SQLiteException e) { getConfigLogger().verbose("Error removing stale records from " + tName, e); return false; } finally { dbHelper.close(); } }
Example #16
Source File: LocalOAuth2Main.java From DeviceConnect-Android with MIT License | 6 votes |
/** * (13)-2.アクセストークンを破棄して利用できないようにする(startAccessTokenListActivity()用. * * @param tokenId トークンID */ public void destroyAccessToken(final long tokenId) { synchronized (mLockForDbAccess) { if (!mDb.isOpen()) { throw new RuntimeException("Database is not opened."); } try { mDb.beginTransaction(); ((SQLiteTokenManager) mTokenManager).revokeToken(tokenId); mDb.setTransactionSuccessful(); } catch (SQLiteException e) { throw new RuntimeException(e); } finally { mDb.endTransaction(); } } }
Example #17
Source File: SubscriptionsDbHelper.java From Twire with GNU General Public License v3.0 | 6 votes |
private ArrayList<Integer> getUsersNotToNotify(SQLiteDatabase db) throws SQLiteException { String query = "SELECT * FROM " + SubscriptionsDbHelper.TABLE_NAME + " WHERE " + SubscriptionsDbHelper.COLUMN_NOTIFY_WHEN_LIVE + "=" + 0 + ";"; Cursor cursor = db.rawQuery(query, null); ArrayList<Integer> usersToNotify = new ArrayList<>(); while (cursor.moveToNext()) { int idPosition = cursor.getColumnIndex(SubscriptionsDbHelper.COLUMN_ID); int userId = cursor.getInt(idPosition); usersToNotify.add(userId); } cursor.close(); return usersToNotify; }
Example #18
Source File: DefaultDownloadIndex.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void putDownload(Download download) throws DatabaseIOException { ensureInitialized(); ContentValues values = new ContentValues(); values.put(COLUMN_ID, download.request.id); values.put(COLUMN_TYPE, download.request.type); values.put(COLUMN_URI, download.request.uri.toString()); values.put(COLUMN_STREAM_KEYS, encodeStreamKeys(download.request.streamKeys)); values.put(COLUMN_CUSTOM_CACHE_KEY, download.request.customCacheKey); values.put(COLUMN_DATA, download.request.data); values.put(COLUMN_STATE, download.state); values.put(COLUMN_START_TIME_MS, download.startTimeMs); values.put(COLUMN_UPDATE_TIME_MS, download.updateTimeMs); values.put(COLUMN_CONTENT_LENGTH, download.contentLength); values.put(COLUMN_STOP_REASON, download.stopReason); values.put(COLUMN_FAILURE_REASON, download.failureReason); values.put(COLUMN_PERCENT_DOWNLOADED, download.getPercentDownloaded()); values.put(COLUMN_BYTES_DOWNLOADED, download.getBytesDownloaded()); try { SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase(); writableDatabase.replaceOrThrow(tableName, /* nullColumnHack= */ null, values); } catch (SQLiteException e) { throw new DatabaseIOException(e); } }
Example #19
Source File: DBLogReader.java From background-geolocation-android with Apache License 2.0 | 6 votes |
private Collection<String> getStackTrace(int logEntryId) throws SQLException { Collection<String> stackTrace = new ArrayList(); SQLiteDatabase db = openDatabase(); Cursor cursor = null; try { DefaultDBNameResolver dbNameResolver = getDbNameResolver(); QueryBuilder qb = new QueryBuilder(dbNameResolver); cursor = mDatabase.rawQuery(qb.buildStackTraceQuery(logEntryId), new String[] {}); while (cursor.moveToNext()) { stackTrace.add(cursor.getString(cursor.getColumnIndex(dbNameResolver.getColumnName(ColumnName.TRACE_LINE)))); } } catch (SQLiteException e) { throw new SQLException("Cannot retrieve log entries", e); } finally { if (cursor != null) { cursor.close(); } } return stackTrace; }
Example #20
Source File: DatabaseGeneralTest.java From sqlite-android with Apache License 2.0 | 6 votes |
@MediumTest @Test public void testSchemaChange3() { mDatabase.execSQL("CREATE TABLE db1 (_id INTEGER PRIMARY KEY, data TEXT);"); mDatabase.execSQL("INSERT INTO db1 (data) VALUES ('test');"); mDatabase.execSQL("ALTER TABLE db1 ADD COLUMN blah int;"); Cursor c = null; try { c = mDatabase.rawQuery("select blah from db1", null); } catch (SQLiteException e) { fail("unexpected exception: " + e.getMessage()); } finally { if (c != null) { c.close(); } } }
Example #21
Source File: DatabaseDriver.java From pandora with Apache License 2.0 | 6 votes |
@Override public List<String> getTableNames(DatabaseDescriptor databaseDesc) throws SQLiteException { SQLiteDatabase database = openDatabase(databaseDesc); try { Cursor cursor = database.rawQuery("SELECT name FROM sqlite_master WHERE type IN (?/*, ?*/)", new String[]{"table"/*, "view"*/}); try { List<String> tableNames = new ArrayList<>(); while (cursor.moveToNext()) { tableNames.add(cursor.getString(0)); } return tableNames; } finally { cursor.close(); } } finally { database.close(); } }
Example #22
Source File: TrackerService.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
public static void closeTracks(Context context, IGISApplication app) { ContentValues cv = new ContentValues(); cv.put(TrackLayer.FIELD_END, System.currentTimeMillis()); String selection = TrackLayer.FIELD_END + " IS NULL OR " + TrackLayer.FIELD_END + " = ''"; Uri tracksUri = Uri.parse("content://" + app.getAuthority() + "/" + TrackLayer.TABLE_TRACKS); try { context.getContentResolver().update(tracksUri, cv, selection, null); } catch (IllegalArgumentException | SQLiteException ignore) { } }
Example #23
Source File: Calendar.java From intra42 with Apache License 2.0 | 5 votes |
private static void addEventToCalendar(Context context, Events event) { if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_CALENDAR) != PackageManager.PERMISSION_GRANTED) { return; } long calID = AppSettings.Notifications.getSelectedCalendar(context); long startMillis; long endMillis; startMillis = event.beginAt.getTime(); endMillis = event.endAt.getTime(); ContentResolver cr = context.getContentResolver(); ContentValues values = new ContentValues(); values.put(CalendarContract.Events.DTSTART, startMillis); values.put(CalendarContract.Events.DTEND, endMillis); values.put(CalendarContract.Events.TITLE, event.name); values.put(CalendarContract.Events.DESCRIPTION, event.description); values.put(CalendarContract.Events.CALENDAR_ID, calID); values.put(CalendarContract.Events.EVENT_LOCATION, event.location); values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getDisplayName()); values.put(CalendarContract.Events.CUSTOM_APP_PACKAGE, BuildConfig.APPLICATION_ID); values.put(CalendarContract.Events.CUSTOM_APP_URI, getEventUri(event.id)); try { cr.insert(CalendarContract.Events.CONTENT_URI, values); } catch (SQLiteException e) { e.printStackTrace(); } }
Example #24
Source File: DataBaseUtils.java From UltimateAndroid with Apache License 2.0 | 5 votes |
/** * * * @return false or true */ private static boolean checkDataBase(String DATABASE_PATH, String dbName) { SQLiteDatabase db = null; try { String databaseFilename = DATABASE_PATH + dbName; db = SQLiteDatabase.openDatabase(databaseFilename, null, SQLiteDatabase.OPEN_READONLY); } catch (SQLiteException e) { Logs.e(e, ""); } if (db != null) { db.close(); } return db != null ? true : false; }
Example #25
Source File: SQLiteClientManager.java From DeviceConnect-Android with MIT License | 5 votes |
/** * 長時間利用されていないクライアントをクリーンアップする.<br> * (1)clientsテーブルにあるがtokensテーブルにトークンが無い場合、clientsの登録日時がしきい値を越えていたら削除する。<br> * (2)clientsテーブルにあるがtokensテーブルにトークンが有る場合、tokensの登録日時がしきい値を越えていたら削除する。<br> * ※(2)の場合、トークンの有効期限内なら削除しない。 * @param clientCleanupTime クライアントをクリーンアップする未アクセス時間[sec]. */ public void cleanupClient(final int clientCleanupTime) { if (mDb != null) { final long msec = 1000; /* 1[sec] = 1000[msec] */ final long cleanupTime = System.currentTimeMillis() - clientCleanupTime * msec; /* (1)に該当するclientsレコードを削除する */ String sql1 = "delete from clients where " + "not exists ( select * from tokens where clients.client_id = tokens.client_id ) " + "and clients.registration_date < " + cleanupTime + ";"; mDb.execSQL(sql1); /* (2)に該当するclientsレコードを削除する */ String sql2 = "delete from clients where " + "exists (select * from tokens where clients.client_id = tokens.client_id) " + "and not exists ( select * from tokens, scopes " + "where clients.client_id = tokens.client_id and tokens.id = scopes.tokens_tokenid " + "and (scopes.timestamp + scopes.expire_period) > " + cleanupTime + ")"; mDb.execSQL(sql2); /* (2)で削除されたclientsのtokensレコードを削除する(clientsがリンク切れしたtokensとscopesを削除する) */ String sql3 = "delete from scopes where not exists (" + "select * from tokens, clients " + "where scopes.tokens_tokenid = tokens.id and tokens.client_id = clients.client_id);"; mDb.execSQL(sql3); String sql4 = "delete from tokens where not exists (" + "select * from clients where tokens.client_id = clients.client_id);"; mDb.execSQL(sql4); } else { throw new SQLiteException("DBがオープンされていません。"); } }
Example #26
Source File: AnsContentProvider.java From ans-android-sdk with GNU General Public License v3.0 | 5 votes |
/** * 数据库表不存在异常 */ private void tableException(SQLiteException sqLiteException) { if (sqLiteException != null && sqLiteException.getMessage() != null) { if (sqLiteException.getMessage().contains("no such table")) { dbReset(); } } }
Example #27
Source File: Bookmark.java From styT with Apache License 2.0 | 5 votes |
public void openMyBookmark(Activity activity) { try { String DBNAME = "MyBookmarkDB"; m_db = activity.openOrCreateDatabase(DBNAME, 0, null); } catch (SQLiteException e) { m_db = null; } }
Example #28
Source File: DatabaseHandler.java From repay-android with Apache License 2.0 | 5 votes |
/** * Lookup the most recent entry in the database * @return Debt representation of most recent debt entered into database * @throws java.text.ParseException * @throws NullPointerException * @throws android.database.sqlite.SQLiteException * @throws android.database.CursorIndexOutOfBoundsException */ public Debt getMostRecentDebt() throws ParseException, NullPointerException, SQLiteException, CursorIndexOutOfBoundsException{ SQLiteDatabase db = getReadableDatabase(); Cursor c; c = db.query(Names.D_TABLENAME, null, null, null, null, null, null); c.moveToLast(); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); db.close(); return new Debt(c.getInt(0), c.getString(1), sdf.parse(c.getString(2)), new BigDecimal(c.getString(2)), c.getString(3)); }
Example #29
Source File: MediaDatabase.java From VCL-Android with Apache License 2.0 | 5 votes |
public void dropMRLTableQuery(SQLiteDatabase db) { try { String query = "DROP TABLE " + MRL_TABLE_NAME + ";"; db.execSQL(query); } catch(SQLiteException e) { Log.w(TAG, "SQLite tables could not be dropped! Maybe they were missing..."); } }
Example #30
Source File: DBAdapter.java From clevertap-android-sdk with MIT License | 5 votes |
synchronized String[] fetchPushNotificationIds(){ if(!rtlDirtyFlag) return new String[0]; final String tName = Table.PUSH_NOTIFICATIONS.getName(); Cursor cursor = null; List<String> pushIds = new ArrayList<>(); try{ final SQLiteDatabase db = dbHelper.getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM " + tName + " WHERE " + IS_READ + " = 0", null); if(cursor!=null){ while(cursor.moveToNext()) { Logger.v("Fetching PID - " + cursor.getString(cursor.getColumnIndex(KEY_DATA))); pushIds.add(cursor.getString(cursor.getColumnIndex(KEY_DATA))); } cursor.close(); } }catch (final SQLiteException e) { getConfigLogger().verbose("Could not fetch records out of database " + tName + ".", e); } finally { dbHelper.close(); if (cursor != null) { cursor.close(); } } return pushIds.toArray(new String[0]); }