The first thing you should keep in mind is that your table has a photmato, so to be ordered you should create a class with the same attributes.
public class TuClase {
int id;
String nombre;
}
This is an example but you know the fields you require. Once you have this class and its constructor methods and their get
and set
you make a ArrayList
of type TuClase
.
ArrayList<TuClase> lista = new ArrayList<TuClase>();
if (cursor .moveToFirst()) {
while (cursor.isAfterLast() == false) {
int id = cursor.getInt(cursor.getColumnIndex(id));
String nombre = cursor.getString(cursor.getColumnIndex(nombre));
TuClase objeto = new Objeto(id,nombre);
list.add(objeto);
cursor.moveToNext();
}
}
So you get all the records and you have them in a list, having this list you can send it to your server depending on how you receive it, the best would be a json.
JSONArray jsonArrayMiLista = new JSONArray(lista);