Mobile ICP1 - abndnc/CS5590-0003 GitHub Wiki

Simple Login: Create a basic login application

Understand the starter code given for text view, button view and make a simple login application with the following requirements.

a.The main activity should look as below (make suitable changes to the login app!).

b.Create the 'LOGIN' button in login screen

c.When clicked on 'LOGIN' button, the screen should navigate to welcome screen if the login credentials are valid otherwise app should display an appropriate message to the user

d.Create the 'LOGOUT' button in welcome screen

e.When clicked on 'LOGOUT' button, the screen should navigate to login screen

Implementation: For the MainActivity script, there are two functions that might be triggered when the Login button is tapped. The first function will check the login inputs by getting them from findViewById() and they are converted into string so that they can be compared to certain string conditions. If both of them are valid, a small text box will announce the user and the second function, redirectToHomePage() will be triggered. Else, the app will require user fix the wrong inputs again.

The redirectToHomePage() changes from MainActivity to HomeActivity. HomeActivity creates the activity_home layout and displays it to the application screen. When the Logout button is tapped, the redirectToHomePage() will be triggered and have the user moved to the activity_main again.

Last but not least, uses-permission is required in AndroidManifest and the additional HomeActivity needs to be imported as well.

Output: