LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new...
Transcript of LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new...
1
• Done by:
• Dr.Kahkashan
• L.Rawan ALAmri
LAB 2
OUTLINE
INTRODUCTION
ARRAY REPRESENTATION
Evaluation
2
1
3
How to create many interfaces
How to connect them
3Output:
Press the button
Steps
5
6
7
8
Change the text content:
9
10
OR:
11
You can change text style:
12
You can change text Background also:
13
Add button:
14
Repeat the same steps to change the button style:
15
Select app folder:
16
12
3
4
Select app folder>> New>> Activity>> Empty Activity:
17
18
19
Go to activity_second_page.xml >> then add text view:
20
Edit the textView using the same steps:
21
Open MainActivity.java:
22
Add the following code inside onCreate method:
Button yourButton = (Button) findViewById(R.id.button);
yourButton.setOnClickListener(new View.OnClickListener() {
@Overridepublic void onClick(View v) {
goToSecondActivity();}
});
23
Add the following code inside MainActivity Class:
private void goToSecondActivity() {
Intent intent = new Intent(this,
SecondPage.class);
startActivity(intent);
}
24
Start AVD Manager:
25
Launch any emulator:
26
Emulator:
27
Run your Project:
28Output:
Press the button
29Output of second interface:
Evaluation
31
32
33Button error (only if there is an error otherwise ignore this slide):
34
THANKS