hello i use this code for diplay my conversation list
private Cursor getMessages( SQLiteDatabase db, boolean justNewMessages) {
final String table = Constants.TABLE_CONVERSATION;
//index
final String[] columns = { Constants.TABLE_CONVERSATION_FIELD_ID, //0
Constants.TABLE_CONVERSATION_FIELD_DATE, //1
Constants.TABLE_CONVERSATION_FIELD_FROM, //2
Constants.TABLE_CONVERSATION_FIELD_TO, //3
Constants.TABLE_CONVERSATION_FIELD_MSG //4
};
String selection;
if(justNewMessages) {
selection = "(" + Constants.TABLE_CONVERSATION_FIELD_FROM + " = '" + jid +"' or "
+ Constants.TABLE_CONVERSATION_FIELD_TO + " = '" + jid + "') and "
+ Constants.TABLE_CONVERSATION_FIELD_NEW + " = '1'";
} else {
selection = "(" + Constants.TABLE_CONVERSATION_FIELD_FROM + " = '" + jid +"' or "
+ Constants.TABLE_CONVERSATION_FIELD_TO + " = '" + jid + "')";
}
final String[] selectionArgs = null;
final String groupBy = null;
final String having = null;
final String orderBy = Constants.TABLE_CONVERSATION_FIELD_DATE;
return db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
}
I would like select 10 last i try
final String orderBy = Constants.TABLE_CONVERSATION_FIELD_DATE + " DESC LIMIT 10";
it is the last conversation, but reversed(the last word is up) how Select only 10 last conversation
OR delete and leaves the 10 last conversation and display this … Cant you help me to start idea I do not understand …
FIXED Thanks for the tips it’s the solution, thanks thanks thanks
Fixed by