例如,我想在RMD中使用CURD,然后同步到ROS
当它处于离线状态时,我可以用RMD获取数据
如何将整个RDM同步到ROS?
这是我的代码:
SearchModel
RealmUtils.getInstance()
.where(Book.class).equalTo("isbn13", isbn)
.findAllAsync().<Book>asObservable()
.subscribe(books -> apiListener.onSuccess(books.size() > 0),
throwable -> apiListener.onFailure(throwable.getMessage()));
InsertModel
RealmUtils.getInstance().asObservable()
.subscribe(realm ->
{
Book book = realm.createObject(Book.class);
book.isbn13 = bookInfoResponse.getIsbn13();
book.title = bookInfoResponse.getTitle();
book.subtitle = bookInfoResponse.getSubtitle();
book.publisher = bookInfoResponse.getPublisher();
book.authors = bookInfoResponse.getAuthors();
book.translators = bookInfoResponse.getTranslators();
book.pubdate = bookInfoResponse.getPubdate();
book.pages = bookInfoResponse.getPages();
book.origin_title = bookInfoResponse.getOrigin_title();
book.image = bookInfoResponse.getImages().getLarge();
book.summary = bookInfoResponse.getSummary();
book.infoString = bookInfoResponse.getInfoString();
apiListener.onSuccess(true);
}, throwable -> apiListener.onFailure(throwable.getMessage()));
DeleteModel
RealmUtils.getInstance()
.where(Book.class).equalTo("isbn13", isbn)
.findAllAsync().<Book>asObservable()
.subscribe(books ->
{
books.deleteAllFromRealm();
apiListener.onSuccess(false);
}, throwable -> apiListener.onFailure(throwable.getMessage()));
这会导致java.lang.IllegalArgumentException: Configurations cannot be different if used to open the same file.
那我该怎么办?