6

im working with realm in android and im getting this error message: error: Field "items" of type "java.util.List" is not supported.

it's at this line:

private List<Item> items;

here is the class:

public class Article extends RealmObject implements Serializable{

@PrimaryKey
private String category;
private List<Item> items;

public String getCategory() {
    return category;
}

public void setCategory(String category) {
    this.category = category;
}

public List<Item> getItems() {
    return items;
}

public void setItems(List<Item> items) {
    this.items = items;
}

}

can anybody help me?

Lucas Navarro
  • 103
  • 1
  • 6

1 Answers1

10

Unfortunately RealmDatabase doesn’t support List<>. But you can achieve the same result by Using RealmList :)

Realm supports subclasses of RealmObject and RealmList to model relationships.

From: https://realm.io/docs/java/latest

Ney Moura
  • 151
  • 1
  • 3