Closed Zhuinden closed 7 years ago
The example managed to end up using only realm.executeTransactionAsync().
realm.executeTransactionAsync()
On background threads, you're supposed to use the following pattern:
public Void doInBackground(Void... nothing) { // start of background thread Realm realm = null; try { realm = Realm.getDefaultInstance(); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { // do execute } }); } finally { if(realm != null) { realm.close(); } } // end of background thread }
This example is missing from the current sample code.
Background operations are shown in https://github.com/Zhuinden/xkcd-example/ (DownloadTask)
DownloadTask
The example managed to end up using only
realm.executeTransactionAsync()
.On background threads, you're supposed to use the following pattern:
This example is missing from the current sample code.