why not return complete data from records?
In a record, the data is,for example,:
ABC, JFKLDJFLDKSJFLDSJFD
But when I queried the returned data is:
ABC
texts after "," and including "," are not displayed.
This is my RunDatabse() inside MainActivity.java, it's called onCreate(Bundle savedInstaneState):
public void RunDatabse() {
DatabaseHelper myDbHelper = new DatabaseHelper(this);
try {
myDbHelper.createDataBase();
DataToDB = myDbHelper.ReadFromDB("Exodus");
TableLayout tablelayout1= (TableLayout)findViewById(R.id.tableLayout1);
tablelayout1.removeAllViews();
for(int i=0;i < DataToDB.length;i++)
{
TableRow tR = new TableRow(this);
result_array = DataToDB[i].split(",");
tR.setPadding(5,5,5,5);
TextView tV_txt1 = new TextView(this);
TextView tV_txt2 = new TextView(this);
tV_txt1.setText(result_array[0]);
tV_txt2.setText(result_array[1]);
tR.addView(tV_txt1);
tR.addView(tV_txt2);
tablelayout1.addView(tR);
}
}
catch (IOException ioe) {
throw new Error("Unable to create database");
}
try {
try {
myDbHelper.openDataBase();
} catch (java.sql.SQLException e) {
e.printStackTrace();
}
}catch(SQLException sqle){
throw sqle;
}
}
This is ReadFromDB(String Selecteditem) inside DatabaseHelper.java:
public String[] ReadFromDB(String Selecteditem) {
ArrayList temp_array = new ArrayList();
String[] notes_array = new String[0];
String sqlQuery = "SELECT * FROM "+Selecteditem+" WHERE chapter='8'" ;
SQLiteDatabase db = this.getWritableDatabase();
Cursor c = db.rawQuery(sqlQuery, null);
if (c.moveToFirst()){
do{
temp_array.add( c.getString(c.getColumnIndex("verse")) +
"," + c.getString(c.getColumnIndex("content"))
);
}while(c.moveToNext());
}
c.close();
notes_array = (String[]) temp_array.toArray(notes_array);
return notes_array;
}
Here is the picture inside my database:
http://i.imgur.com/ra0ZowX.png[
^]
Here is the picture returned:
http://i.imgur.com/KGhk857.png[
^]
how to return all complete data from records?