In this lab, you will learn to implement the essentials of Android Studio and working with Java & XML!
By the end of this lab, you will have a template of a signin page.
In this lab, we'll be creating a sign in page using TextView, EditText & Button!
-
Create and set up a new
Android Studio
project:- Go to new -> new project -> Empty Activity.
- Make sure your code is in Java.
-
In your XML file:
- Change the layout to
LinearLayout
.- Don't forget the LinearLayout attributes.
- Center all the objects within the layout.
- Add:
- A
TextView
that says SignIn. - Two
EditTexts
for email & password, hint: Don't forget the difference between hint and text. - Two
Buttons
one says signin and the other signup.- Organize the buttons to be next to each, hint: LinearLayout & weight.
- Don't forget to add ids
- A
- Use margins to improve the appearance of the page.
- Change the layout to
-
In your Java file:
- Connect the views from the
XML file
to theJava file
. - Set an
onclick listener
for both button: - When the signinButton
is clicked:- Set the text of the EditTexts to be the email of the user.
- When the signup
Button
is clicked: - Using Toast, display "Signup is under construction" as a message.
- Set the text of the EditTexts to be the email of the user.
- When the signup
- Connect the views from the
- Perform the function of the signin button only if:
- The email contains "@" & ".com"
- The password is 6 characters long.