问题描述
我创建的 sqlite 数据库包含两个图像。我想显示一张图片。然后,当我点击图像时,我会显示存储在 sqlite 数据库中的第二个图像。图像存储为字符串。
我的采用者方法
public Bitmap getMemorie(int id){
sqliteDatabase db = getWritableDatabase();
String enc = "data:image/png;base64";
Cursor cursor = db.rawQuery("select * from memories where _id=?",new String[]{String.valueOf(id)});
if(cursor.movetoNext()){
enc = String.valueOf(cursor.getColumnIndex(MemoryContract.MemoryEntry.COLUMN_logo));
}
String pure=enc.substring(enc.indexOf(",")+1);
byte[] encodeByte = Base64.decode(pure,Base64.DEFAULT);
Bitmap decodeByte = BitmapFactory.decodeByteArray(encodeByte,encodeByte.length);
返回解码字节; }
我的活动
Intent intent =getIntent();
//getting extras which are sent from first activity
int myposition=intent.getExtras().getInt("id");
Log.d("h","the cat is " + myposition);
//Cursor data = dbHelper.getMemorie("select * from memories where _id= ?",+myposition);
this.dbHelper = new MemoryDbHelper(this);
this.imageview.setimageBitmap(dbHelper.getMemorie(myposition));
错误的 base64 java.lang.IllegalArgumentException: 错误的 base-64
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)