Hi there , The last time we have created the user Interface Of our Android Application . We created many screens and Views , today we will learn how to connect between them!..
First , we have to create two more Activities : SignUpForm Activity class and LogInForm Activity Class . We will set signup.xml as the layout of SignUpForm Activity and set the login.xml as the layout of LogInForm Activity ..
The Code of SignUpForm.java :
The Code of LogInForm,java :
We will notice from the previous codes that setContentView(R.layout.login); or setContentView(R.layout.signup); >> setContentView is used to set the layout and the view of the screen using (R.layout.layoutName)..
The Code of CATaZineActivity.java :
//The previous class set : main.xml using ( R.layout.main )as the layout of the this Activity ..
Then, create two buttons signUpButton ,logInButton that we will use to go to the signUp Form and LogInForm . Create two OnClick Methods , both of them use the intent to transfer from view to another. one method for SignUp Button and one for LogIn Button , so you can go to any view just by Clicking on a Button!..
The last thing you have to do is to define the activities in AndroidManiFest.xml by adding the Following xml code Lines to your it :
The full code of AndroidManiFest.xml File :
Now , try to press signUp Button >> you will go to SignUp Form and press LogIn Button you will go to LogIn Form ..
That’s all , Thanks! ..