I have following text in SQLITE database in TEXT field
The exact date of his birth is not known. The consensus of opinion, however, is that he was born around 580 B.C He was younger than the his friends.
He belonged to a noble family.
When I read this from DB and add to ArrayList<String> I get following error message
14): unknown error: Unable to convert BLOB to string
14): unknown error: Unable to convert BLOB to string
14): unknown error: Unable to convert BLOB to string
14): unknown error: Unable to convert BLOB to string
14): Closing Cursor
I am confused why its becoming a blob? here is how I am reading this
String select = "SELECT heading,text FROM details WHERE chapter_id = \'" + tocIDX + "\'" ;
Constants.c = Constants.myDataBase.rawQuery(select, null);
int headingIndex = Constants.c.getColumnIndex("heading");
int headingTextIndex = Constants.c.getColumnIndex("text");
Constants.c.moveToFirst();
if (Constants.c != null) {
if (Constants.c.isFirst()) {
int i = 0;
/* Loop through all Results */
do {
i++;
if(Constants.Debug){
Log.d("toc", "Row # " + i);}
try{
headingIndex.add(Constants.c.getString(headingIndex));
headingTextIndex.add(Constants.c.getString(headingTextIndex));
} catch (Exception e) {if(Constants.Debug){Log.d("toc", e.getMessage());} }
} while (Constants.c.moveToNext());
Highly appreciate your help
I think the data type of heading and text columns are defined as BLOB. you can substring the data to get You have two way.
Approach-1) use SUBSTRING to get string from the BLOB data.
Approach-2) If possible use VARCHAR instead of BLOB as data type