CursorLoader cursorLoader = new CursorLoader(this, Browser.SEARCHES_URI, Browser.SEARCHES_PROJECTION, null, null, null); Cursor cursor = cursorLoader.loadInBackground(); if (cursor.getCount() == 0) return; Calendar cal = Calendar.getInstance(); cursor.moveToFirst(); while (cursor.isAfterLast() == false) { String id = cursor.getString(Browser.HISTORY_PROJECTION_ID_INDEX); String word = cursor.getString(Browser.SEARCHES_PROJECTION_SEARCH_INDEX); long dateTime = Long.parseLong(cursor.getString(Browser.SEARCHES_PROJECTION_DATE_INDEX)); cal.setTimeInMillis(dateTime); Log.w("###", id + " | " + word + " | " + cal.getTime().toString()); cursor.moveToNext(); }
result
7 | 호호호 | Sat Nov 02 11:08:51 GMT+09:00 2013 8 | youtube | Sat Nov 02 11:08:59 GMT+09:00 2013
만약 검색 기록이 없다면 아무 것도 나오지 않는다.