LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new...

34
Done by: Dr.Kahkashan L.Rawan ALAmri LAB 2

Transcript of LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new...

Page 1: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

1

• Done by:

• Dr.Kahkashan

• L.Rawan ALAmri

LAB 2

Page 2: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

OUTLINE

INTRODUCTION

ARRAY REPRESENTATION

Evaluation

2

1

3

How to create many interfaces

How to connect them

Page 3: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

3Output:

Press the button

Page 4: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

Steps

Page 5: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

5

Page 6: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

6

Page 7: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

7

Page 8: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

8

Change the text content:

Page 9: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

9

Page 10: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

10

OR:

Page 11: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

11

You can change text style:

Page 12: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

12

You can change text Background also:

Page 13: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

13

Add button:

Page 14: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

14

Repeat the same steps to change the button style:

Page 15: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

15

Select app folder:

Page 16: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

16

12

3

4

Select app folder>> New>> Activity>> Empty Activity:

Page 17: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

17

Page 18: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

18

Page 19: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

19

Go to activity_second_page.xml >> then add text view:

Page 20: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

20

Edit the textView using the same steps:

Page 21: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

21

Open MainActivity.java:

Page 22: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

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();}

});

Page 23: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

23

Add the following code inside MainActivity Class:

private void goToSecondActivity() {

Intent intent = new Intent(this,

SecondPage.class);

startActivity(intent);

}

Page 24: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

24

Start AVD Manager:

Page 25: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

25

Launch any emulator:

Page 26: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

26

Emulator:

Page 27: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

27

Run your Project:

Page 28: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

28Output:

Press the button

Page 29: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

29Output of second interface:

Page 30: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

Evaluation

Page 31: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

31

Page 32: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

32

Page 33: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

33Button error (only if there is an error otherwise ignore this slide):

Page 34: LAB 2 · 2020-02-09 · Create New Project Configure your project Empty Activity Creates a new empty activity Name Second Lab Package name com.example.secondlab Save location Language

34

THANKS