I am trying to understand the concept of ObservableList
and Realms
. I have tried to create an instance of an ObservableList
like this:
public ObservableList createObservableList() {
ObservableList myObsList = new ObservableList(new ArrayList<String>(),
"test") {
};
return myObsList;
}
But when I call this method I get:
org.eclipse.core.runtime.AssertionFailedException: null argument:Realm cannot be null
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
I understand that this have something to do we the default realm is not set. But where do I find documentation on these concepts?
I have looked at this:
http://wiki.eclipse.org/JFace_Data_Binding/Observable
...but it contains very limited information/examples.
I also have the Eclipse EMF book but cannot find any examples of how to use eg. ObservableList
Where do I find tutorials/documentation on rules/concepts behind Observable?
I have now tried the following:
public static ObservableList createObservableList() {
ObservableList myObsList = null;
Realm.getDefault().exec(new Runnable() {
@Override
public void run() {
myObsList = new ObservableList(new ArrayList<String>(), "test") {
};
}
});
return myObsList;
}
...but that does not work since myObsList
must be final. Changing it to final makes it impossible to update it inside the run method.
Any suggestions?