There is a custom adapter for a list of views in which messages are added. The sequence of messages comes from the top down. How to sort messages in a different order, new below? Such is the code ..
ArrayList<DialogSaveData> UpList = new ArrayList<>(); adapter = new CastomDialog(ChatActivity.this, R.layout.castom_dialog_list, UpList); //присваиваем адаптер списку chat.setAdapter(adapter); Cursor cursor = db.query("mess", null, "idto =? or idme = ?" , new String[]{idyou.replaceAll("\\s+",""),idyou.replaceAll("\\s+","")}, null, null, null); if (cursor.moveToFirst()) { do { UpList.add(0, new DialogSaveData( cursor.getString(cursor.getColumnIndex("idme")), cursor.getString(cursor.getColumnIndex("idto")), cursor.getString(cursor.getColumnIndex("data")), myLoginCript.replaceAll("\\s+",""), cursor.getString(cursor.getColumnIndex("status")) )); } while (cursor.moveToNext()); }