Last active
December 22, 2017 13:52
-
-
Save Zhuinden/c54169a8a9cd2ca26ba91ed4399849ad to your computer and use it in GitHub Desktop.
Monarchy 3: Managed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity | |
extends AppCompatActivity { | |
ManagedDogAdapter managedDogAdapter; | |
LiveData<Monarchy.ManagedChangeSet<RealmDog>> changes; | |
Observer<Monarchy.ManagedChangeSet<RealmDog>> observer = | |
changes -> { | |
managedDogAdapter.updateData(changes); | |
}; | |
@BindView(R.id.recycler_view) | |
RecyclerView recyclerView; | |
@Inject | |
Monarchy monarchy; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
... | |
managedDogAdapter = new ManagedDogAdapter(); | |
changes = monarchy.findAllManagedWithChanges( | |
realm -> realm.where(RealmDog.class)); | |
changes.observe(this, observer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment