システムにエラーや警告がないと仮定すると、次のようなものがありますか?
Wanted_LoginController.java:
Intent intent = new Intent(loginMVC.getLoginView(),ErrorView.class);
intent.putExtra("errorMsg", errorMsg);
loginMVC.getLoginView().startActivity(intent);
Wanted_ErrorView.java:
Intent executedIntent = getIntent();
LoginMVC loginMVC = executedIntent.getParameter1(); //will store loginMVC context from previous intent data
ErrorView errorView = executedIntent.getParameter2(); //will store errorview from previous intent data
私のカスタムオブジェクト
ErrorView.java:
public class ErrorView extends Activity{
ErrorView context;
Bundle extras;
}
LoginView.java:
public class LoginView extends ListActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
//check the device's connection to the internet
ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if(mWifi.isConnected()){
new LoginController(new LoginMVC(new LoginData(), this)); //builds a new controller for the login process
}else{ //blocks the user to proceed to login when internet connection is not available
finish();
Intent intent = new Intent(this,ErrorView.class);
intent.putExtra("errorMsg", "Please enable Wi-Fi");
startActivity(intent);
}
}
}
LoginMVC.java:
public class LoginMVC{
LoginData loginModel;
LoginView loginView;
LoginController loginController;
public LoginMVC(LoginData pLoginModel, LoginView pLoginView, LoginController pLoginController){
loginModel = pLoginModel;
loginView = pLoginView;
loginController = pLoginController;
}
public LoginMVC(LoginData pLoginModel, LoginView pLoginView){
loginModel = pLoginModel;
loginView = pLoginView;
}
public LoginController getLoginController(){
return loginController;}
}
ありがとう!