ActiveAndroid 不在 Sqlite 中保存 blob 类型数据(图像)

ActiveAndroid Not saving blob type data(Image) in Sqlite

这是我的模型 class ...我想使用 activeandroid 在数据库中插入图像文件。我将图像文件转换为字节 ...但字节未存储在 Db 中 ...字段类型在 Table 中是 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 支持保存字节数组和定义自定义 type serializer 可能有助于 you.From 性能视图,创建一个列作为字符串并从磁盘或 Web 获取图像更有用。