this is the function where i fetch my users according to the latest text msg first but the query doesnt seem to work. can any one help me out here.
public HashMap<String, String> show_chat_list (String uid){
HashMap<String, String> friend_list = new HashMap<String, String>();
here is the query for fetching the name of the users engaged in a chat
String selectQuery = "select * from friendlist where _id in (select com_id from chat_list order by _id desc)";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// Move to first row
boolean st = cursor.moveToFirst();
if (st == true) {
if (cursor.moveToFirst()) {
do {
cfrname += cursor.getString(cursor.getColumnIndex("name")) + ":";
friend_list.put("frname", cfrname);
cfruid += cursor.getString(cursor.getColumnIndex("_id")) + ":";
friend_list.put("fruid", cfruid);
badger += cursor.getString(cursor.getColumnIndex("badger")) + ":";
friend_list.put("badger", badger);
cfrthumb += cursor.getString(cursor.getColumnIndex("thumb")) + ":";
friend_list.put("frthumb", cfrthumb);
}
while (cursor.moveToNext());
}
} else {
friend_list.put("frname", "notdatainsql");
friend_list.put("fruid", "notdatainsql");
friend_list.put("frthumb", "notdatainsql");
friend_list.put("badger", "notdatainsql");
}
cursor.close();
db.close();
return friend_list;
}
Aucun commentaire:
Enregistrer un commentaire