Hello All,
I have this code pulling data from an SQLite db with multiple columns and records. It works fine, but it displays the record information with the 1st record being displayed 1st. I want to reverse the order so that the LAST record displays first, then the rest with the 1st record being displayed last.... is there an easy way to do this? I've seen several youtube vids but none of them address what i'm trying to do, they just reverse the order of the words, i.e.: Hello becomes olleH. Any help is appreciated. Here is the code i'm using to create the stringbuffer:
public void viewAll() { button_view.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Cursor res = myDb.getLoadData(); if(res.getCount() == 0) { // show message showMessage ("Error","No loads found..."); return; } StringBuffer buffer = new StringBuffer(); while (res.moveToNext()) { buffer.append("UNIQUE ID #: " + res.getString(0) + "\n\n"); buffer.append("LOAD #: " + res.getString(1) + "\n\n"); buffer.append("PICKUP AT: " + "\n" + res.getString(9) + "\n\n"); buffer.append("ON: " + "\n" + res.getString(10) + "\n\n"); buffer.append("DELIVER TO: " + "\n" + res.getString(14) + "\n\n"); buffer.append("ON: " + "\n" + res.getString(15) + "\n\n"); buffer.append("PAY: " + res.getString(19) + "\n\n"); buffer.append("========================" + "\n\n"); } // Show all data showMessage("LOADS - Basic Info",buffer.toString()); } } );