fun getHistoryList(index:Int) {
	// SQLite의 order by 이후에 ROWNUM 효과를 위한 구문
	val afterOrderBy = "date DESC LIMIT ${index + 20} OFFSET $index"
	/**
	SELECT	date, transcription, photo_id, subscription_component_name, call_screening_app_name, type, geocoded_location, presentation, duration, subscription_id, is_read, number,
			features, voicemail_uri, normalized_number, via_number, matched_number, last_modified, new, numberlabel, lookup_uri, data4, photo_uri, data3, data2, data1, data_usage,
			phone_account_address, formatted_number, add_for_all_users, block_reason, numbertype, call_screening_component_name, countryiso, name, post_dial_digits, transcription_state, _id
	FROM (SELECT * FROM calls WHERE logtype IN (100, 110, 150, 500, 800, 900, 950, 1000, 1050, 1100, 1150, 1350, 1400, 1450, 1500) ORDER BY date DESC ) calls
	ORDER BY date DESC LIMIT 20 OFFSET 0
	*/

	val cursor = Fragment.contentResolver.query(CallLog.Calls.CONTENT_URI, null, null, null, afterOrderBy)
}

sqlite에서는 rownum 대신에 LIMIT을 사용한다.

전화이력 조회시 전체 조회하니 목록 화면 전환시 딜레이가 생겨서 20개씩 읽어들이는 걸로 하기 위해서 위와 같은 코드를 작성하였다.

[출처] 전화이력 목록 조회|작성자 Jayden