hello am new at android development. am creating an app that has four columns. Student, age, number and class...but the data displayed under the columns is disorganized, how can i organize the data displayed in proper columns?
here is my code. my database name = schooldatabase
String[] columns = new String[] { KEY_ROWID, KEY_STUDENT, KEY_AGE,
KEY_ID_NUMBER, KEY_CLASS };
Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null,
null, null);
String result = "";
ArrayList<String> mArrayList = new ArrayList<String>();
int IROW = c.getColumnIndex(KEY_ROWID);
int ISTUDENT = c.getColumnIndex(KEY_STUDENT);
int IAGE = c.getColumnIndex(KEY_AGE);
int INUMBER = c.getColumnIndex(KEY_ID_NUMBER);
int ICLASS = c.getColumnIndex(KEY_CLASS);
// ////////////////////////////////////////////////////////
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
// ////////////////////////////////////////////////////
result = result + c.getString(IROW) + " " + c.getString(ISTUDENT)
+ " " + " " + c.getString(IAGE) + " " + " "
+ c.getString(INUMBER) + " " + " " + c.getString(ICLASS)
+ "\n";
}
return result;
Aucun commentaire:
Enregistrer un commentaire