ActiveAndroid不将Blob类型数据(图像)保存在Sqlite中 [英] ActiveAndroid Not saving blob type data(Image) in Sqlite

查看:96
本文介绍了ActiveAndroid不将Blob类型数据(图像)保存在Sqlite中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的模型类...我想使用activeandroid .i转换图像文件到db中插入图像文件到字节中...但是字节没有存储在Db中...表中的字段类型是Blob

This is My model class ...i want to insert image file in db using activeandroid .i converted image file into bytes ... but bytes is not stored in Db ... the field type in Table is Blob

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;

@Table(name = "contact")

public class Contact extends Model {
    @Column(name = "ID")
    private int ID;
    @Column(name = "NAME")
    private String name;
    @Column(name = "PHOTO")
    private String photo;
    @Column(name = "TITLE")
    private String title;
    @Column(name = "PHONE")
    private String phone;
    @Column(name = "EMAIL")
    private String email;
    @Column(name = "MEMO")
    private String memo;
    @Column(name = "Image")
    private byte[] _image;`


推荐答案

AA支持保存字节数组并定义自定义
类型的序列化器可能会帮助您。从性能角度来看,它更有用,它可以创建一列作为字符串,并从磁盘或网络中获取图像。

AA supports saving byte arrays and defining custom type serializer maybe could help you.From performance view, its more useful create a column as a string and get the image from the disk or the web.

这篇关于ActiveAndroid不将Blob类型数据(图像)保存在Sqlite中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆