hering
hering

Reputation: 1954

ActiveAndroid returns always empty results

I tried to add ActiveAndroid to my first Android app. No errors so far, my items are being saved (I checked it with an sqlite manager) but no matter what query I use the result is always empty. I only have one model (Todo) and only strings, booleans and one date to be saved. (see below)

I use Android 6.0 SDK 23 with Genymotion emulator and ActiveAndroid 3.0.

What I tried:

The size of the lists is always 0 and item (when searching for one item) is always null. I get no errors.

Any ideas?

Here is my model:

package xyz.tdoo.model;

import * 

@Table(name = "Todos")
public class Todo extends Model {
    @Column(name = "name")
    public String name;

    @Column(name = "description")
    public String description;

    @Column(name = "done")
    public Boolean isDone = false;

    @Column(name = "favourite")
    public Boolean isFavourite = false;

    @Column(name = "duedate")
    public Date dueDate;

    public Todo(String name) {
        super();
        this.name = name;
    }

    public static ArrayList<Todo> findAll() {
        return new Select().from(Todo.class).execute();
    }

    public static Todo findOne(int id){
        return new Select().from(Todo.class).where("id = ?", id).executeSingle();
    }
}

Upvotes: 2

Views: 519

Answers (2)

Александр
Александр

Reputation: 31

You need to add empty constuctor:

public Todo() {
    super(); 
}

Upvotes: 0

hering
hering

Reputation: 1954

I ended up using SugarORM. It fits my simple needs and worked from the very beginning. Also I found out that ActiveAndroid is a bit old and not maintained any more.

Upvotes: 1

Related Questions