1
00:00:00,280 --> 00:00:00,870
Everyone.

2
00:00:00,910 --> 00:00:04,940
So in this tutorial I'm going to actually create an object.

3
00:00:04,980 --> 00:00:05,400
OK.

4
00:00:05,610 --> 00:00:09,470
So let's actually first let's go to the activity.

5
00:00:09,540 --> 00:00:11,920
Let's go to the content underlayment and examine here.

6
00:00:12,120 --> 00:00:14,610
So let me show you the Android view at the top menu.

7
00:00:14,610 --> 00:00:19,350
Just click on View and install windows and then click on project if you want to you can actually use

8
00:00:19,560 --> 00:00:22,280
this shortcut here for Mac users.

9
00:00:22,290 --> 00:00:27,480
You can actually hold down the command key on your keyboard down and then press on the number one key

10
00:00:27,480 --> 00:00:28,300
on your keyboard.

11
00:00:28,500 --> 00:00:32,010
And if you are using a Windows machine the shortcut is different.

12
00:00:32,010 --> 00:00:37,200
It should be actually a control just hold under control on your keyboard down and the person number

13
00:00:37,200 --> 00:00:38,040
one on the keyboard.

14
00:00:38,040 --> 00:00:39,270
So just click on it.

15
00:00:39,270 --> 00:00:39,960
Now here it is.

16
00:00:39,960 --> 00:00:40,970
Our Android view.

17
00:00:40,980 --> 00:00:41,260
Right.

18
00:00:41,290 --> 00:00:42,930
It is not Android view.

19
00:00:43,020 --> 00:00:45,000
Here you can see these two little triangles.

20
00:00:45,000 --> 00:00:47,330
If you click on it you can actually see the left and right.

21
00:00:47,550 --> 00:00:50,800
So now here let's open the rest for their.

22
00:00:50,810 --> 00:00:56,480
Well there we have this folder open the layout folder and double click on this content underlayment

23
00:00:56,490 --> 00:00:57,000
and examined.

24
00:00:57,000 --> 00:01:03,120
So now let me double tap here in order to make this area wider so let's actually select this text here.

25
00:01:03,330 --> 00:01:06,690
So now let's pro-white an ID for this text.

26
00:01:06,720 --> 00:01:12,120
So what I am actually providing an ID for the state's view because I've want to interact with this text

27
00:01:12,120 --> 00:01:14,270
view from my Java coats.

28
00:01:14,430 --> 00:01:20,200
So here for the ID just step in here takes the one and then person enter on your keyboard.

29
00:01:20,250 --> 00:01:20,660
Right.

30
00:01:20,820 --> 00:01:22,980
So now you may ask what is this.

31
00:01:23,040 --> 00:01:25,460
This view here is actually called the blueprint.

32
00:01:25,470 --> 00:01:26,050
Right.

33
00:01:26,100 --> 00:01:27,900
So here look at this bar here.

34
00:01:28,140 --> 00:01:29,310
Here we have some options.

35
00:01:29,310 --> 00:01:33,190
The first one here it says let me hover over this and it says show design.

36
00:01:33,210 --> 00:01:38,240
If you just click on this one here now you can see that the blueprint is actually disappear.

37
00:01:38,490 --> 00:01:41,610
Let's look at the second icon it says show blue print.

38
00:01:41,880 --> 00:01:45,600
If I click on it now you can see that only we have the blue print here.

39
00:01:45,600 --> 00:01:48,080
So I'll talk more about blue print later for not.

40
00:01:48,090 --> 00:01:54,280
You can just see that how we can actually appear or disappear the blue paint or a design.

41
00:01:54,400 --> 00:01:56,330
And let's actually look at the first icon.

42
00:01:56,340 --> 00:02:01,150
If I click on it it says Now we can show the design plus blueprint.

43
00:02:01,230 --> 00:02:01,730
Right.

44
00:02:01,980 --> 00:02:06,870
So if you want to you can just click on this short and so that you can actually only see this design

45
00:02:06,870 --> 00:02:07,810
here.

46
00:02:07,830 --> 00:02:10,740
So the idea of these things is take Steven.

47
00:02:10,740 --> 00:02:13,630
Now let's go to the main activity class here.

48
00:02:13,830 --> 00:02:17,220
And it's actually for example create an object of a text.

49
00:02:17,220 --> 00:02:19,380
So here I can see text view.

50
00:02:19,630 --> 00:02:20,110
OK.

51
00:02:20,130 --> 00:02:26,230
So first I referred to the name of this class text view and now I can't see th Steven.

52
00:02:26,460 --> 00:02:30,330
So this is the name of the variable that you want to create here.

53
00:02:30,330 --> 00:02:38,130
Assignment operator now able to actually be fair to the user interface objects that we have in say the

54
00:02:38,130 --> 00:02:39,990
contents underlying minute exempt.

55
00:02:40,020 --> 00:02:47,540
So here first of all I can say find view by ID so you can actually find out if you buy a specific ID.

56
00:02:47,550 --> 00:02:53,590
So that's why we actually provided an ID for that actually for the text.

57
00:02:53,670 --> 00:03:00,950
So I hear I hear see or or is a class that actually holds the ideas that we actually provide for their

58
00:03:01,020 --> 00:03:04,900
user interface components inside our layout.

59
00:03:04,920 --> 00:03:13,490
So our thought Id dot the one so you can see now I can only to this takes the one Id semicolon.

60
00:03:13,860 --> 00:03:18,900
So now as you can see if you have an error it says there is an error and it says incompatible type.

61
00:03:19,080 --> 00:03:25,080
It is required Android that widget that takes view found and read that view that view.

62
00:03:25,080 --> 00:03:30,840
So it says that the variable that we have created here is actually of tapes view and now here we are

63
00:03:30,840 --> 00:03:37,590
saying find view by id it can actually find an object of type view not a text view.

64
00:03:37,980 --> 00:03:43,690
So I talked more about this later but text view let me tell you that takes is a subclass of view.

65
00:03:43,790 --> 00:03:46,520
Our view is the superclass of taste.

66
00:03:46,650 --> 00:03:53,280
So here we need to cast this takes view object the user interface component to a text view object in

67
00:03:53,280 --> 00:04:00,960
order to actually let the Android know that we are a hundred and fifty percent sure that this user interface

68
00:04:00,960 --> 00:04:04,700
components that we are referring to is of type takes view.

69
00:04:04,830 --> 00:04:11,250
So we need to actually be 100 percent sure and we need to let the Android know that we are actually

70
00:04:11,250 --> 00:04:14,520
sure that it is a test view if it is not of this view.

71
00:04:14,520 --> 00:04:18,130
Let me try to show you the lay out content underlayment an example.

72
00:04:18,210 --> 00:04:19,610
Here we have it takes you right.

73
00:04:19,620 --> 00:04:25,920
The idea is this is the one if this is not actually a tissue for example if this is a button and here

74
00:04:25,950 --> 00:04:30,870
let's go to the main activity class and here we say that this is actually a text view.

75
00:04:30,870 --> 00:04:34,940
Our application is going to crash because we have a button inside our lay out.

76
00:04:35,130 --> 00:04:37,110
And here we are saying that we have a takes.

77
00:04:37,140 --> 00:04:43,800
If I actually just for example it to a text so I must be sure that this user interface component is

78
00:04:43,830 --> 00:04:47,070
takes view and then I can go to this man with the class.

79
00:04:47,130 --> 00:04:50,070
So here I cant just put a pair of parentheses.

80
00:04:50,280 --> 00:04:51,860
So this is called casting.

81
00:04:51,900 --> 00:04:52,350
OK.

82
00:04:52,500 --> 00:04:57,630
So you know you will learn more about Castanea in Dover later for an hour to 40 and just put a pair

83
00:04:57,630 --> 00:05:02,980
of Prentice's here and just type in here takes you be capital-T and then select this one and that person

84
00:05:02,980 --> 00:05:04,150
entered on your keyboard.

85
00:05:04,170 --> 00:05:10,690
So now the error is gone but now you may actually encounter error regarding actually important actually

86
00:05:10,760 --> 00:05:12,000
and write that widget.

87
00:05:12,120 --> 00:05:15,260
So let me hear at the top you can see these imports statement.

88
00:05:15,270 --> 00:05:22,440
If I open it here you can see this plus sign here if I click on it here you can see that I auto imported

89
00:05:22,830 --> 00:05:29,210
this and write that widget that takes you if you see any errors here regarding importing their takes

90
00:05:29,220 --> 00:05:30,650
view class to our file.

91
00:05:30,690 --> 00:05:37,620
You need to put this line of code here import and write that we did to take that view but I also imported

92
00:05:37,680 --> 00:05:40,110
this class to add to my file.

93
00:05:40,110 --> 00:05:42,080
How did they do that in the next tutorial.

94
00:05:42,110 --> 00:05:43,640
You are going to learn about that.

95
00:05:43,860 --> 00:05:46,860
So thank you very much for watching and I'll see you in the next tutorial.

