1 00:00:00,960 --> 00:00:04,500 ‫Narrator: Hi. Within this lecture we are going to change 2 00:00:04,500 --> 00:00:07,590 ‫the image inside of our image view. 3 00:00:07,590 --> 00:00:08,670 ‫In order to do that, 4 00:00:08,670 --> 00:00:11,520 ‫I'm gonna write image view and I'm referring 5 00:00:11,520 --> 00:00:16,030 ‫to this image view and I will say .setImageResource 6 00:00:18,060 --> 00:00:21,090 ‫So this is what we are looking for. 7 00:00:21,090 --> 00:00:23,460 ‫So this is a method, 8 00:00:23,460 --> 00:00:27,660 ‫that looks for a parameter inside of this drawble 9 00:00:27,660 --> 00:00:32,130 ‫and it changes the content of the image view accordingly. 10 00:00:32,130 --> 00:00:33,180 ‫So for example, 11 00:00:33,180 --> 00:00:37,401 ‫I can just write R.drawble.metallica2. 12 00:00:37,401 --> 00:00:42,120 ‫So metallica is in my current imagery right now 13 00:00:42,120 --> 00:00:45,930 ‫and I will change it to metallica2 14 00:00:45,930 --> 00:00:50,370 ‫Okay, so that's what this code does. 15 00:00:50,370 --> 00:00:53,190 ‫And last but not least, 16 00:00:53,190 --> 00:00:58,190 ‫we have written change image over here 17 00:00:59,130 --> 00:01:03,510 ‫and also in the change bottom we have to declare 18 00:01:03,510 --> 00:01:06,630 ‫the same thing on the own click property 19 00:01:06,630 --> 00:01:07,860 ‫of this bottom as well. 20 00:01:07,860 --> 00:01:10,050 ‫So I'm going to write change image 21 00:01:10,050 --> 00:01:12,660 ‫in a exact way that I have written 22 00:01:12,660 --> 00:01:16,710 ‫over here with a uppercase I, for example. 23 00:01:16,710 --> 00:01:21,710 ‫So after that you can write View with a capital V. 24 00:01:22,530 --> 00:01:27,390 ‫And if it asks for an import you can just hit alt enter 25 00:01:27,390 --> 00:01:28,953 ‫and then say view. 26 00:01:30,000 --> 00:01:34,470 ‫So this is for letting Android Studio know 27 00:01:34,470 --> 00:01:36,990 ‫that this method is going to be called 28 00:01:36,990 --> 00:01:40,833 ‫by pressing a view, a button in our case. 29 00:01:41,670 --> 00:01:44,580 ‫If you do not understand what's going on, 30 00:01:44,580 --> 00:01:47,820 ‫if you're just writing but if you cannot understand 31 00:01:47,820 --> 00:01:50,850 ‫the logic behind it, just don't worry 32 00:01:50,850 --> 00:01:54,360 ‫because we are not learning how to code here. 33 00:01:54,360 --> 00:01:56,310 ‫We're gonna do that in the next lecture. 34 00:01:56,310 --> 00:01:59,059 ‫Okay, So let me run this. 35 00:01:59,059 --> 00:02:02,670 ‫I mean in the next section where we deep dive into Java 36 00:02:02,670 --> 00:02:04,440 ‫we are just getting familiarized 37 00:02:04,440 --> 00:02:07,140 ‫with Android Studio at this section. 38 00:02:07,140 --> 00:02:11,010 ‫Okay, now if I hit this change button, here we go. 39 00:02:11,010 --> 00:02:15,810 ‫My image has been changed due to the codes 40 00:02:15,810 --> 00:02:19,533 ‫that I have written under my change image method. 41 00:02:20,550 --> 00:02:21,750 ‫So that's it. 42 00:02:21,750 --> 00:02:24,390 ‫We have defined the image view and we managed 43 00:02:24,390 --> 00:02:29,087 ‫to change a property of that image view with code. 44 00:02:29,087 --> 00:02:33,960 ‫All we had to do is just define the image view with the ID 45 00:02:33,960 --> 00:02:38,901 ‫that we have specified in the activity main XML file. 46 00:02:38,901 --> 00:02:43,901 ‫And then we use that image view to change the image source. 47 00:02:45,090 --> 00:02:48,060 ‫So we haven't written anything under on create 48 00:02:48,060 --> 00:02:51,419 ‫because we didn't want anything to happen when 49 00:02:51,419 --> 00:02:53,640 ‫this activity is created. 50 00:02:53,640 --> 00:02:56,400 ‫But rather we want something to happen under 51 00:02:56,400 --> 00:02:59,520 ‫this change image method. 52 00:02:59,520 --> 00:03:04,331 ‫So if you do double slashes over here you can take notes 53 00:03:04,331 --> 00:03:08,340 ‫and as you can see if I write something gibberish over here, 54 00:03:08,340 --> 00:03:09,540 ‫it won't work 55 00:03:09,540 --> 00:03:13,080 ‫because the understood will give me some error. 56 00:03:13,080 --> 00:03:15,090 ‫So if you want to take some notes, 57 00:03:15,090 --> 00:03:17,790 ‫you can use this double slash notation. 58 00:03:17,790 --> 00:03:22,127 ‫Okay, so maybe you can think something like that. 59 00:03:22,127 --> 00:03:25,860 ‫Why am I making the second word uppercase? 60 00:03:25,860 --> 00:03:28,110 ‫Like at the beginning of the second word 61 00:03:28,110 --> 00:03:30,921 ‫like this change image with an uppercase I, 62 00:03:30,921 --> 00:03:34,170 ‫image view with the uppercase V. 63 00:03:34,170 --> 00:03:35,940 ‫So let me tell you, 64 00:03:35,940 --> 00:03:40,035 ‫there is something called snake case annotation or notation. 65 00:03:40,035 --> 00:03:42,311 ‫So this is kind of a sign tax. 66 00:03:42,311 --> 00:03:46,147 ‫This is kind of a set rule that some programmers follow. 67 00:03:46,147 --> 00:03:49,920 ‫Okay? And there is also something called Camel Case 68 00:03:49,920 --> 00:03:51,330 ‫and it's written like that. 69 00:03:51,330 --> 00:03:55,650 ‫So in snake case we have some underscores between words 70 00:03:55,650 --> 00:03:58,560 ‫and over here we have upper cases between words 71 00:03:58,560 --> 00:04:01,066 ‫so that we can actually read it better. 72 00:04:01,066 --> 00:04:05,430 ‫So we already have something called Pascal Case as well. 73 00:04:05,430 --> 00:04:08,879 ‫So it starts with a upper case P, 74 00:04:08,879 --> 00:04:12,180 ‫but most of the time in Android development 75 00:04:12,180 --> 00:04:14,490 ‫we use Camel Case. 76 00:04:14,490 --> 00:04:17,490 ‫And in classes you can see Pascal Case 77 00:04:17,490 --> 00:04:19,530 ‫in use like main activity. 78 00:04:19,530 --> 00:04:21,150 ‫And we are gonna see what the classes 79 00:04:21,150 --> 00:04:23,550 ‫and why do we use Pascal Case 80 00:04:23,550 --> 00:04:26,503 ‫in that case later on in the following section. 81 00:04:26,503 --> 00:04:29,310 ‫But know that it really doesn't matter 82 00:04:29,310 --> 00:04:33,499 ‫if we use Snake Case or Camel Case or something like that. 83 00:04:33,499 --> 00:04:35,820 ‫But most of the developers 84 00:04:35,820 --> 00:04:39,540 ‫in under development generally follow Camel Case, 85 00:04:39,540 --> 00:04:42,540 ‫so we are going to follow that combination as well 86 00:04:42,540 --> 00:04:45,150 ‫so that when you go to the Stacker Workflow 87 00:04:45,150 --> 00:04:47,693 ‫or any other developer website look for it 88 00:04:47,693 --> 00:04:49,663 ‫under a studio code then that, 89 00:04:49,663 --> 00:04:52,350 ‫that you won't get surprised, okay? 90 00:04:52,350 --> 00:04:56,111 ‫You will be familiarized with that kind of combination. 91 00:04:56,111 --> 00:04:59,580 ‫So we're gonna stick to the Camel Case and again, 92 00:04:59,580 --> 00:05:02,040 ‫it really doesn't matter for Android Studio 93 00:05:02,040 --> 00:05:03,780 ‫which one we use. 94 00:05:03,780 --> 00:05:06,330 ‫So, there are a lot of things that we should cover 95 00:05:06,330 --> 00:05:08,340 ‫like this great old main activity 96 00:05:08,340 --> 00:05:10,612 ‫or other manifest files and stuff. 97 00:05:10,612 --> 00:05:13,170 ‫We are gonna go over later on 98 00:05:13,170 --> 00:05:16,380 ‫in the following section where we will deep dive 99 00:05:16,380 --> 00:05:18,840 ‫into Java and then we will learn 100 00:05:18,840 --> 00:05:20,880 ‫about the Android development a little bit 101 00:05:20,880 --> 00:05:22,830 ‫and then we will move on. 102 00:05:22,830 --> 00:05:25,170 ‫Okay? So we're gonna stop here 103 00:05:25,170 --> 00:05:27,213 ‫and see you in the next section.