package org.ntlab.irisclient; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import android.os.Bundle; import org.ntlab.irisclient.viewmodels.DrawingStateViewModel; public class DrawingActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drawing); DrawingStateViewModel drawingStateViewModel = new ViewModelProvider(this).get(DrawingStateViewModel.class); drawingStateViewModel.getDno().observe(this, new Observer<Integer>() { private Integer dno; @Override public void onChanged(Integer dno) { this.dno = dno; } }); drawingStateViewModel.getState().observe(this, new Observer<Integer>() { private Integer state; @Override public void onChanged(Integer state) { this.state = state; } }); } }