‫Narrator: Hi. Within this lecture we are going to change
‫the image inside of our image view.
‫In order to do that,
‫I'm gonna write image view and I'm referring
‫to this image view and I will say .setImageResource
‫So this is what we are looking for.
‫So this is a method,
‫that looks for a parameter inside of this drawble
‫and it changes the content of the image view accordingly.
‫So for example,
‫I can just write R.drawble.metallica2.
‫So metallica is in my current imagery right now
‫and I will change it to metallica2
‫Okay, so that's what this code does.
‫And last but not least,
‫we have written change image over here
‫and also in the change bottom we have to declare
‫the same thing on the own click property
‫of this bottom as well.
‫So I'm going to write change image
‫in a exact way that I have written
‫over here with a uppercase I, for example.
‫So after that you can write View with a capital V.
‫And if it asks for an import you can just hit alt enter
‫and then say view.
‫So this is for letting Android Studio know
‫that this method is going to be called
‫by pressing a view, a button in our case.
‫If you do not understand what's going on,
‫if you're just writing but if you cannot understand
‫the logic behind it, just don't worry
‫because we are not learning how to code here.
‫We're gonna do that in the next lecture.
‫Okay, So let me run this.
‫I mean in the next section where we deep dive into Java
‫we are just getting familiarized
‫with Android Studio at this section.
‫Okay, now if I hit this change button, here we go.
‫My image has been changed due to the codes
‫that I have written under my change image method.
‫So that's it.
‫We have defined the image view and we managed
‫to change a property of that image view with code.
‫All we had to do is just define the image view with the ID
‫that we have specified in the activity main XML file.
‫And then we use that image view to change the image source.
‫So we haven't written anything under on create
‫because we didn't want anything to happen when
‫this activity is created.
‫But rather we want something to happen under
‫this change image method.
‫So if you do double slashes over here you can take notes
‫and as you can see if I write something gibberish over here,
‫it won't work
‫because the understood will give me some error.
‫So if you want to take some notes,
‫you can use this double slash notation.
‫Okay, so maybe you can think something like that.
‫Why am I making the second word uppercase?
‫Like at the beginning of the second word
‫like this change image with an uppercase I,
‫image view with the uppercase V.
‫So let me tell you,
‫there is something called snake case annotation or notation.
‫So this is kind of a sign tax.
‫This is kind of a set rule that some programmers follow.
‫Okay? And there is also something called Camel Case
‫and it's written like that.
‫So in snake case we have some underscores between words
‫and over here we have upper cases between words
‫so that we can actually read it better.
‫So we already have something called Pascal Case as well.
‫So it starts with a upper case P,
‫but most of the time in Android development
‫we use Camel Case.
‫And in classes you can see Pascal Case
‫in use like main activity.
‫And we are gonna see what the classes
‫and why do we use Pascal Case
‫in that case later on in the following section.
‫But know that it really doesn't matter
‫if we use Snake Case or Camel Case or something like that.
‫But most of the developers
‫in under development generally follow Camel Case,
‫so we are going to follow that combination as well
‫so that when you go to the Stacker Workflow
‫or any other developer website look for it
‫under a studio code then that,
‫that you won't get surprised, okay?
‫You will be familiarized with that kind of combination.
‫So we're gonna stick to the Camel Case and again,
‫it really doesn't matter for Android Studio
‫which one we use.
‫So, there are a lot of things that we should cover
‫like this great old main activity
‫or other manifest files and stuff.
‫We are gonna go over later on
‫in the following section where we will deep dive
‫into Java and then we will learn
‫about the Android development a little bit
‫and then we will move on.
‫Okay? So we're gonna stop here
‫and see you in the next section.