Lesson 3 - How to create login and register screen (Part 1)





Tonikami TV Tutorials
Lets Start (Understand the concept)

  • first go to MainActivity.java 
  • just keep OnCreate method


  • create new activity name that Login.xml
  • create one more name that Register.xml


go to login.xml

  • change to LinearLayout
  • orientation = Vertical
  • layout_width=match_parent
  • layout_height=match_parent
  • android:pading="10dp"



 <Textview

  • layout_width=wrap_content
  • layout_heightwrap_content
  • android:text= "username"

<EditText

  • android:id="@+id/etUsername"
  • layout_width=match_parent
  • layout_height=wrap_content
  • android:layout_marginBottom="10dp"



<Textview

  • layout_width=wrap_content
  • layout_height=wrap_content
  • android:text= "password"


<EditText

  • android:id="@+id/etPassword"
  • layout_width=match_parent
  • layout_height=wrap_content
  • android:inputtype="textpassword"
  • android:layout_marginBottom="10dp"


<Button
  • android:id="@+id/bLogin"
  • android:text="Login"
  • layout_width= match_parent
  • layout_height= wrap_content

RESULT




now copy the whole login.xml and paste in register.xml
change login text to "Register"

<Button
  • android:id="@+id/bRegister"                 <-----------------------------change
  • android:text="Register"                          <-----------------------------change
  • layout_width= match_parent
  • layout_height= wrap_content


add extra for Name Tab

<Textview

  • layout_width=wrap_content
  • layout_height=wrap_content
  • android:text= "Name"


<EditText

  • android:id="@+id/etName"
  • layout_width=match_parent
  • layout_height=wrap_content
  • android:layout_marginBottom="10dp"

add extra for Age Tab


<Textview

  • layout_width=wrap_content
  • layout_height=wrap_content
  • android:text= "Age"


<EditText

  • android:id="@+id/etAge"
  • layout_width=match_parent
  • layout_height=wrap_content
  • android:layout_marginBottom="10dp"


now from register.xml
copy and paste to
main.xml

delete password editText and TextView

<Button
  • android:id="@+id/bLogout"                 <-----------------------------change
  • android:text="Logout"                          <-----------------------------change
  • layout_width= match_parent
  • layout_height= wrap_content

We are done with the Screen Activity 

In this Lesson:

We create 3 screen Activity
1. Login
2.Register
3.Show Age and Name

Next Lesson - How to work with Intent and java class


Previous
Next Post »