как поместить форму намерения действие-A в Activity-B из Button1 и Activity-A в Activity-C из Button2 в DataBinding (модель MVVM) из действия A в Android.
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;
public static final int start_status = 1;
public static final int intent_status = 2;
public static int current_status = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LoginViewModel loginViewModel = ViewModelProviders.of(this).get(LoginViewModel.class);
binding = DataBindingUtil.setContentView(MainActivity.this, R.layout.activity_main);
binding.setLifecycleOwner(this);
binding.setLoginViewModel(loginViewModel);
loginViewModel.getUser().observe(this, new Observer<User>() {
@Override
public void onChanged(@Nullable User loginUser) {
switch (current_status){
case start_status :
Intent intentt = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intentt);
break;
case intent_status :
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intent);
break;
}
Intent intentt = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intentt);
}
});
}
}