所以,我有一个控制器,可以实现我应用程序的所有逻辑。在此控制器中,我想控制三个作为片段的类。当我单击“下一步”时,我想调用另一个片段并使用相同的控制器,但是我不知道该怎么做。有可能吗?
这是代码
CONTROLLER
private void inicializeResources(LayoutInflater inflater, ViewGroup container) {
view = inflater.inflate(R.layout.fragment_pacient_register, container, false);
pacientRegisterView = new PacientRegisterView(view);
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
//setHasOptionsMenu(true);
pacientRegisterView.getNextButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
pacientRegisterView.getBackButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent login = new Intent(, LoginController.class);
getActivity().startActivity(login);
}
});
}
示例视图
public PacientRegisterContactView(View view) {
countrySpinner = (Spinner) view.findViewById(R.id.countrySpinner);
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
neighborhoodEditText = (EditText) view.findViewById(R.id.neighborhoodEditText);
cityEditText = (EditText) view.findViewById(R.id.cityEditText);
contactNumberEditText = (EditText) view.findViewById(R.id.contactNumberEditText);
postalCodeEditText = (EditText) view.findViewById(R.id.postalCodeEditText);
backButton = (Button) view.findViewById(R.id.buttonContactBack);
nextButton = (Button) view.findViewById(R.id.buttonContactNext);
}
public Spinner getCountrySpinner() { return countrySpinner; }
public EditText getStreetEditText() { return streetEditText; }
public EditText getNeighborhoodEditText() { return neighborhoodEditText; }
public EditText getCityEditText() { return cityEditText; }
public EditText getContactNumberEditText() { return contactNumberEditText; }
public EditText getPostalCodeEditText() { return postalCodeEditText; }
public Button getBackButton() { return backButton; }
public Button getNextButton() { return nextButton; }