https://kotlinlang.org logo
Title
c

codeslubber

10/02/2017, 3:29 PM
Using the new MVP Architecture Patterns (which are pretty awesome btw) on O and wiring up a ViewModel, came across this in the docs:
public class MyActivity extends AppCompatActivity {
    public void onCreate(Bundle savedInstanceState) {
        MyViewModel model = ViewModelProviders.of(this).get(MyViewModel.class);
        model.getUsers().observe(this, users -> {
            // update UI
        });
    }
}
Obviously this is Java. In getting a syntax for the observer that would compile in Kotlin, I ended up doing an Observer<ModelType>(){} construct, is this as it should be?