ActiveAndroid不保存Sqlite中的blob类型数据(Image)

时间:2015-07-21 05:37:05

标签: android sqlite activeandroid

这是我的模型类...我想在db中使用activeandroid .i转换后的图像文件插入图像文件到字节...但是字节不存储在Db中...表中的字段类型是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;`

1 个答案:

答案 0 :(得分:0)

AA支持保存字节数组,定义自定义type serializer可能对您有所帮助。从性能视图来看,它更有用,可以将列创建为字符串并从磁盘或Web获取图像。