ViewModel cannot be instantiated in an Activity
问题 I am trying to instantiate one ViewModel to use across all of my Activity(s). public class LaunchActivity extends Activity { private Controller control; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launch); control = ViewModelProviders.of(this).get(Controller.class); } } but I got an error at control = ViewModelProviders.of(this) <-- stating that it cannot resolve of(this) , but based on the example here by