I'm planning to implement an Android application that requires a login screen.
If the user opens the activity something like this should happen:
So, what's the "correct" way of implementing a login?
StartActivity
that perfoms the check if the user is logged in, implement a LoginActivity
that implements the logging and an ApplicationActivity
that actually implements the application logics?Are there any examples or tutorials for this scenario?
The most popular android architectures used by developers are the following: MVC (Model — View — Controller) MVP (Model — View — Presenter) MVVM (Model — View — ViewModel)
getUserName(MainActivity. this). length() == 0) { // call Login Activity } else { // Stay at the current activity. } In Login activity if user login successful then set UserName using setUserName() function.
I don't think that there is a "correct" way of doing this. Both solutions you describe seem fine to me, although I would merge StartActivity
and LoginActivity
into a single one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With