Is it okay to initialize model in the View when you're using MVP Architecture in Android? Here is the View class for example:
public class ViewActivity extends BaseActivity {
@BindView(R.id.lastNameEdt)
EditText lastNameEdt;
@BindView(R.id.firstNameEdt)
EditText firstNameEdt;
@BindView(R.id.middleNameEdit)
EditText middleNameEdit;
User userModel; <-----
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
userModel = new User();
userModel.firstName = lastNameEdt.getText.toString();
}
}
I would like to know what is the best approach / good practice when implementing MVP architectural pattern, especially for Android.
The reason why I initialized the model in the view it's because I want to pass it on another activity through intent. What do you think is the best? Is it still acceptable if I put the model on the View or should I put it on the presenter?