
我怎样才能做到这一点 ???解决方法 首先,convert bitmap to byte array
Bitmap bmp = intent.getExtras().get("data");ByteArrayOutputStream stream = new ByteArrayOutputStream();bmp.compress(Bitmap.CompressFormat.PNG,100,stream);byte[] byteArray = stream.toByteArray(); 稍后,将byte []保存到Realm中
注意:字符串和字节数组(byte [])不能大于16 MB(来自Realm文档)
字段类型
总结Realm supports the following fIEld types: boolean,byte,short,ìnt,long,float,double,String,Date and byte[]. The integer types byte,int,and long are all mapped to the same type (long actually) within Realm. Moreover,subclasses of RealmObject and RealmList are supported to model relationships.
以上是内存溢出为你收集整理的在android中将图像插入realm数据库全部内容,希望文章能够帮你解决在android中将图像插入realm数据库所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)