 Hey everybody my name is Brian and we are going to start with Android programming. So if you head out to developerandroid.com you'll see that the newest version and this made date this video is actually Android 7.1 called Nougat. Android has some really funky naming conventions they're actually kind of comical but once you get used to them there you know you appreciate them. Android has actually grown throughout the years. It has changed several times. So in other tutorials you will find that you'll follow along with a tutorial and it just won't work. You know things are depreciated, things no longer exist, some things broken whatever. This video and this series is being started in January of 2016. I will try to stick with the core of Android so hopefully a lot of if not all of the things that we discussed won't get depreciated in time because they are the core of Android. There are some prerequisites. The first thing you need to do is go out to developerandroid.com click on develop and you will see this Android studio and there will be a number here. To date it's 2.2 that will obviously increment with time but go ahead and download Android studio is the foundation IDE of what you need to make an Android program. Sure you can use another IDE but this is directly from Google it makes sense to use their tools and there is a lot of resources out here. You can watch all these videos they even have you know training you can go through a full course on you to me which I actually tried for a while but like I said it was outdated so I got to a certain point and then I had to flip over to Google and say why isn't this working and then you know somebody who knew much more about it than I did would say well it's stupid you're using the wrong version use this and that and it got very confusing so that is actually why I'm building these tutorials because the resources that I found out there really weren't all that up to date. So go ahead and download Android studio. I'm not going to insta- insta- I cannot talk I'm not going to cover how to install it because it can install on almost any operating system. I have this installed on Mac Linux multiple versions of Windows. Most of the installs went fairly flawlessly it's fairly simple there's a couple little gotchas that I'll cover later on in this video but for the most part it just worked now on my Linux box there are a couple dependencies I had to go ahead and install but a simple google search you just kick out the error message onto Google and gave me the command line that I needed. I'm not going to give you the command line because you may not have the error you'll have a different version of Linux but if you're on Linux I think you're probably smart enough to figure out what to do. All right the other prerequisite other than Android studio is a fundamental knowledge of Java now I know a bunch you're going oh come on this is actually a beginner's tutorial you don't need very much Java at all so if you have no Java at all go out to YouTube type in void realms java void realms is all one word void realms by the way is also the name of my website and the user group out in Facebook that you'll hear me talk about quite a bit and well somebody copied my videos I guess those were popular anyways um you basically go out to the official void realms Java and you can go out to my channel and learn a lot of other languages but I've got 28 videos out there and it'll take you from knowing nothing about Java to actually being able to write some fairly good programs um they won't be you know highly complex or anything like that but it'll give you a fundamental knowledge of Java and then maybe take you a day or if that to go through them they're pretty short videos once you have a fundamental version fundamental understanding of Java and you have Android studio go and crack open Android studio and I've actually got some code opened up and I'm just going to kind of walk you through what the IDE looks like it'll look a little different you have to make a project and then it'll open up to this but there's also some other things that you're going to need to do right off the bat and I don't remember if the installer asked you for it I know and I think it was Windows it actually did but I think I'm Mac it didn't and I had to go in and do it myself another reason why I'm not covering the installation process but it's a fairly simple IDE you've got your menus across the top you've got your toolbar and then you have you know your project structure or your code structure depending on which view you're in and then you have your tabs for your different files that are open and this little guy here called breadcrumbs so you can find your way back if you were on a file whatever you needed to do all right so before you do anything you need to do a few simple steps one of them if I can find these is here it is you need your android virtual device manager and your SDK manager and there's a couple other things like you know project structure and help but really what you need to focus on is click the SDK manager and you can see how I've got partially installed or update available these are the actual android versions and you can see it goes all the way back to 2.1 eclair and these if you're ever heard of like lollipop or jelly bean that's the actual names of them but they each one has a number so like version 4.1 to 4.3 was called jelly bean you know that's kind of how they kind of group that instead of calling it 414243 they just call it jelly bean I think somebody correct me if I'm wrong this is the internet so I'm sure somebody will correct me but they switch names based off of what they depreciate so things that were in jelly bean are no longer available in cat cat or they added so many features that it might as well just be called something else but anyways you go out to this SDK let me show you to get there again it's this little air down arrow over the android guy SDK manager where you hunt and pack through the menus and get it and you'll want to download I stick with kind of the newest now there's a middle ground here it's hard to really explain but if you go with the oldest there aren't many devices out there using it if you go with the newest there aren't many devices out there using it so you kind of stick with the middle of the road here that'll be your biggest user base but you see how you have what's called an API level certain parts of android have a minimum API requirement meaning if you're going to use certain things you need to have a certain level of API based off what they've added or what they've depreciated there's also this revision number that's somewhat important too that shows you the revision of that SDK now if you wanted to download one of these you just click it you see a little icon appears and it says okay reply as soon as you do that it'll start downloading I'm not going to do it because it's time consuming I would recommend for learning purposes you do the newest versions I kind of do one or two versions sometimes three that's because you want to know the latest and greatest tools because by the time you master those tools they may be in production use or they may be on the verge of being depreciated depending on what they were it's always a catch up game when you're learning something new especially in computers now for production I would stick with middle of the road in this case on January of 2016 it's android 4.3 jellybean that seems to be one of the bigger user install bases actually it might actually be ice cream 4.0 but you understand what I'm saying for learning go with the newest for production go with the middle of the road typically unless you're doing some legacy work you don't really mess around with the older ones so you're going to want to check off you know a couple of these and just hit apply and as soon as you do that it'll start downloading and installing these you need the SDKs installed in order to work with these things and here is why after you've downloaded that you'll go into what's called the android virtual device manager and you see I've got some devices in here now what is a virtual device manager you may ask android programming should be done on an android device I have you can't see it but I have my android phone right in front of me and that is my main device that I program however this phone is limited to the SDK that's currently running on it and they make model a manufacturer that it's built with so you can do virtual devices meaning you can actually create a virtual phone which to play around with so we're going to create one and you can pick from all sorts of things from TVs to wearables to phones to tablets and each one of these is kind of uh you know different you got to just kind of read it it gives you the size over here the dimensions things like that the manufacturer uh you like you can take a google nexus I actually have one of those in the other room you can make nexus s something like that that's a pretty big phone you take a small little 3.3 so I'm just going to grab like a nexus 4 you can say next this is where the SDKs come into play here you have to pick what SDK you want that phone to have you can see I've already got some of them downloaded now if you skip the previous step you can see there's a download link so you can actually download like new yet I'm just going to say marshmallow because I already have it installed and I'm just going to click next and we'll just give this a name and we'll call this um what's the name of that really crappy movie I watched I had killer clowns from outer space that was like the worst movie ever it was so bad it was actually kind of funny but then you can control some basic properties like the startup orientation and some advanced settings that you really don't need to get into at this point all right now there's my killer clowns from outer space you can see how there's a little start button here so if I start this you'll see that android studio starts doing some stuff in the background here and it's starting the android virtual device killer clowns from outer space which is probably not a great name I'll end up changing that but point being you will have the ability to run emulators and on these emulators you can run your code so if you don't even own an android device you don't even have a cell phone it takes a while for these emulators to start up as you can see you now have a virtual phone right in front of you that you can run your code on now there are some limitations here this may change in the future it may be changing as I speak it may actually be you know completely wrong what I'm telling you but my understanding is that android emulators do not allow some of the more basic things like wi-fi access so if you're writing a program that relies on the internet you're not going to really be able to do much in the emulator but it's you know it's a full-fledged phone right you can see you've got a browser and all sorts of stuff in here and we can actually say and I mean you've got internet but if you're doing something on your local network with wi-fi I'm sorry it's just not going to work there's certain things like that that little gotchas and you've got this little toolbar here that you can control your emulator and you can click more to get into some of the properties here so you can actually give it like a latitude and longitude you can give it a cellular you can give it a battery status you can give it a phone number that by the way is not my phone number so please don't go calling that because you're going to get some you'll probably get some engineer at google is going to say who's this um it's kind of funny I left that in there though you know I kind of want to call that now just to see why I'm going to call that after this video just to see who picks up the phone it's probably like a google thank you for using android you can give it a fingerprint you can give it virtual device sensors and all sorts of other crazy settings um emulators are convenient but they're slow they're very very slow the appropriate way and actually let me let me kill that emulator and let me kill this um let me grab my cable here if you hear some background noise I'm woefully unprepared I told myself I wasn't going to do any programming today and then I was like hey let's just make a tutorial so I'm going to plug my usb cable into my computer and then plug my phone in and there is a trick to this you'll have to go into what's called developer mode and I'll do that in a future tutorial but basically when you launch this now this little launch button over here you'll see we have a connected device that's my actual physical phone sitting in front of me but I also have all these other virtual machines that I've made there's you know killer clowns from outer space which did I misspell outer oh my god that's embarrassing um point being you can use your physical device or you can use an emulator but if you're going to use an emulator you're going to have some limitations before you can use the emulator you need your sdks installed if you have your physical phone you're probably good on the sdks you'll probably need them installed just so that you can program against them because in your actual scripts when you make an android program where is it you'll have your compiled sdk version versus your minimum sdk version so you'll need to have those installed for the compiler to know what the heck you're doing that is a lot of talk so we're going to go over the fundamentals of an android program something that almost every android program will have you can see there's this android manifest file we'll crack this open um this is basically just an xml file that outlines what your application does and what permissions it needs so when you download something off google store and it says hey it needs the internet or it needs to control the wi-fi or the network that's how you actually define those privileges and you define what activities and intents are we'll cover those in future tutorials just know at this point in time that there are things out there called activities and intents but that's how you define them and you would also define receivers for broadcast receivers and services which is code that runs in the background the structure of these programs is just pure java i shouldn't call it pure java it's not really truly java it's like google's kind of take on java but it's still java so you'll have imports um you'll have classes and you know listeners and all sorts of fun stuff so every little idiosync could see that java has is going to carry over into android so if you're not a big java fan you know you will get used to it i'm not a big java fan myself but i've actually gotten kind of fluent in it um you'll have your java folder which is where the bulk of your code goes and then you'll have you know example instrument test and then you know example unit test i haven't really played around with those a whole lot you'll also have your android monitor down here which is where all your debug statements go and you can see the actual device in real time the gpu and stuff like that because i have it plugged in and you can make filters so let me no filters yeah see there's the actual data pumping out of my physical phone right now so if i were to just let's see if i can yeah all i did was unlock my phone and all that stuff starts streaming out here and you can filter it so that only your program goes through and you'll have debug and all sorts of fun stuff all right from here you also have a resource folder now resource is kind of like a catchall meaning if it's not code it's a resource did i just say if it's not code yeah that's the canadian in me coming out my family's actually canadian um so the drawable folder this is where well your images would go and we'll cover how to get those in there there's a little trick to it as with everything android there's a little trick layouts these are your actual activities um let me show one here so this is what the end user would actually see this is how you would put your buttons and your spinners and your checkboxes on a screen you can lay it out either by dragging and dropping or by doing the actual xml personally i'm not very i'm not an xml god let's just put it that way so i typically drag and drop things on and then if i need to i'll go into the actual code and tweak it but usually i just drag and drop i dare say 90 of what you need can actually be done by drag and drop and there is a lot of widgets out there i mean just tons and tons of widgets and you can create your own it's not very hard um so just know that we're probably not going to cover all these but we will cover a good chunk of these at least the ones that you're going to need to do a basic application all right so then you have these mip map this is your launcher icon that is the actual icon that would go on your i don't know what it's called the android screen that you have all your programs on i don't want to call it a desktop because it's not a desktop the android screen launch screen that's what i think that's what it's called um so you'll have your own custom one and these can be different sizes different pixels you know some of them are you know more granular than others and then you have raw typically raw are just raw data files i have mp3s out here because my program plays sound don't worry internet these are royalty free sounds and royalty free pictures and then you'll have values such as strings and dimensions and all colors and all sorts of stuff that you really should use but to be honest i really haven't because i just am very lazy but i will show you how to use all those things all right so that in a nutshell is android studio and the structure of an android program now before you go there's a couple other little things you should be aware of um go out to facebook and search for void realms there's a group out there we have 1170 members wow 21 new people this thing just keeps growing and growing these people are from all walks of life um i think the bulking are from c++ from the tutorials that i've done in there but i've asked a lot of java and android programs and i mean within like in some cases literally seconds i get an answer back in some cases it's like maybe a half hour if it's a really complex sometimes it's a day but usually people are really fast and everybody just kind of helps out so request the membership to the void realms group and also visit my site void realms dot com i'm going to start posting the source code for this and other tutorials out here i'll actually have a little drop down in here that says android and i'll have all the source code out there um so also if you want the source code for the java tutorials you can just go out there and go to java and boom they're all right here well that's it i hope you found this educational entertaining and i will see you in the next video