Browse Source

Increased history query efficiency

master
Anthony Restaino 10 years ago
parent
commit
4c75b9ffb5
  1. 4
      src/acr/browser/lightning/HistoryDatabaseHandler.java

4
src/acr/browser/lightning/HistoryDatabaseHandler.java

@ -122,6 +122,7 @@ public class HistoryDatabaseHandler extends SQLiteOpenHelper {
Cursor cursor = mDatabase.rawQuery(selectQuery, null); Cursor cursor = mDatabase.rawQuery(selectQuery, null);
// looping through all rows and adding to list // looping through all rows and adding to list
int n = 0;
if (cursor.moveToLast()) { if (cursor.moveToLast()) {
do { do {
HistoryItem item = new HistoryItem(); HistoryItem item = new HistoryItem();
@ -131,7 +132,8 @@ public class HistoryDatabaseHandler extends SQLiteOpenHelper {
item.setImageId(R.drawable.ic_history); item.setImageId(R.drawable.ic_history);
// Adding item to list // Adding item to list
itemList.add(item); itemList.add(item);
} while (cursor.moveToPrevious()); n++;
} while (cursor.moveToPrevious() && n < 5);
} }
cursor.close(); cursor.close();
// return item list // return item list

Loading…
Cancel
Save