just to show why using normal OOP pattern is much ...
# android
m
just to show why using normal OOP pattern is much cleaner than Android's intent. If you want to show login, it’s easier to do it like this:
Copy code
fun showLogin() {
    val loginActivity = LoginActivity(someConfiguration);
    loginActivity.setOnLoginSuccess { user : User -> // handle login }
    loginActivity.show();
}
than this:
Copy code
val KEY_CONFIG  = "MY_KEY" // This has to be defined in LoginActivity
-----

val LOGIN_REQUEST = 1

fun showLogin() {
    var intent = Intent(...);
    intent.putExtra(LoginActivity.KEY_CONFIG, configValue); 
    startActivityForResult(intent, LOGIN_REQUEST); 
}

override onActivityResult(requestCode : Int , resultCode : Int , data: Intent )  {
    if (requestCode == LOGIN_REQUEST_CODE) {   
        // handle login
    }
}