【发布时间】:2012-08-07 08:10:16
【问题描述】:
我想将一个长字符串存储到 android 的 sqlite 中。 我通过以下方式将其写入sqlite:
String content = bodytext.toString();
byte[] contentByte = content.getBytes();
Log.d("bytetoString",new String(contentByte));
String sql1 = "insert into content(id,content) values( '" + messageID
+ "','" + contentByte + "');";
db.execSQL(sql1);
我通过以下方式阅读它:
String sql = "select * from content where id='" + messageID + "'";
Cursor temp = db.rawQuery(sql, null);
if (temp.moveToNext()) {
byte[] contentByte = temp.getBlob(temp.getColumnIndex("content"));
String sb = new String(contentByte);
Log.d("String",sb);
temp.close();
return sb;
}
但是,当我打印刚刚阅读的字符串时。它打印出类似“[B@41431930??”的内容,有什么问题吗?
【问题讨论】: