Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In the exercises in this video series, I'll be working on an application called the Explore California Tour Finder, and I'll start by showing you how to build the beginning of that application. I'll go to the menu in ADT, the Android Developer Tools, and select File > New > Android Application Project. I'll give my application a name of Explore CA, for California. The project name will be the same but without any spaces. For the package name, which uniquely identifies the application on your Android device, I will start the package with the reverse domain notation of com.exploreca, and then I'll finish it with .tourfinder.
I'll leave the Minimum Required SDK to API 8 Android 2.2 or Froyo. In nearly all of the exercises in this course, I'll be using code that works all the way from 2.2 up through the most recent version of Android, 4.2. I'll set the Target SDK to the most recent version, Android 4.2, Jelly Bean, and I'll accept all the other defaults and click Next. On the screen I'll deselect the option to create a custom launcher icon.
I'll be adding a launcher icon from the exercise files. And then I'll click Next again. I'll be creating a blank activity as my application's main activity, so I'll accept the default here and click Next. And I'll use the suggested Activity Name and Layout Name. So I'll click Finish and that will create the project. When the application is first created it opens to the main activity layout. It's showing here in XML view. On your computer, it might also open up in the graphical layout, but you can switch back and forth between them using the tabs at the bottom of the editor.
The default main activity has a single text view object centered on the screen. We'll leave that in place for the moment, and I'll launch the application in an emulator. I'll go up to the toolbar and click the Run button. I already have my emulator running. If you don't, it might take a few moments to fire up the emulator and load the application. When the application loads in the emulator, you should see the output Hello World! I'll go back and add one more feature.
I'll replace the default launcher icon-- that's the little Android robot--with a custom icon that I've included in the exercise files. I'll return to Eclipse and because I've placed the exercise files on the desktop, I can just drag Eclipse over to the right. I'll open the exercise files and go to the Assets folder and from there to a folder called Launcher Icons. I've created four versions of my launcher icon, one in each of the pixel-density folders.
So there's one for low density, one for medium, one for high, and one for extra high. I'll open the version in the high-density folder and show you that it's a graphic based on the Explore California Assets, and these are graphics and data files that I'll be using throughout the course. So to load these into my application I'll go back to the folder that contains the folder names that start with drawable. Then I'll select and copy those four folders to the clipboard. I'll return to Eclipse and expand it to full screen again.
Then, in the package explorer, I'll go to the RES, or Resources, folder and I'll paste those folders into place. I'm pressing Command+V on Mac. You can press Ctrl+V if you're working on Windows. When prompted to overwrite, I will say Yes To All, and that will add those graphics into their respective folders. I still have the graphics that were created when I created the project. They are called ic_launcher, but now I have the four versions of my graphic in the correct places.
To register those graphics, I'll go to the AndroidManifest.xml file. I'll double-click to open it and if it opens in the graphical interface, as it did here, I'll click on the XML View tab. I'll expand this to full screen. Then I'll go down to the icon attribute, and I'll change this from ic_launcher to ic_exploreca. To see a list of available drawable resources, you press Ctrl+Space, and then I've selected ic_exploreca. And the application will automatically load the right version of the graphic, depending on what kind of device it's running on.
I'll save those changes and I'll run the application in the emulator again. Many times I'll be launching the application in the emulator using a keyboard shortcut. I'm pressing Command+Shift+F11 on Mac. So, I'll click back here, and I'll press my keyboard shortcut to run the application. Then I'll switch back to the emulator and after a moment, the application is loaded and I see my launcher icon shows here. I'll go back to the Home screen in the emulator, and I'll go into my application list, which in Jelly Bean is represented by this icon in the bottom center of the hot seat, the area at the bottom of the screen.
My application is shown here as well, and again it uses the appropriate version of the launcher icon for this device. I can open the application from here. I can click and hold and drag the icon into place on the Home screen. I'll remove that. I'll go back to the application list, and very importantly, I can also uninstall the application by dragging it up to the Uninstall icon, or get into the App info and find out such things as how much data is being used by the application.
If there is any personal data, I can clear it from here as well. So, that's to look at how to get started building the base application for this course. Once it's been created and once you have the emulator running, I recommend keeping the emulator open throughout all of your development work, so you don't have to wait for it to open each time you want to run or debug.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101414 Viewers
61 Video lessons · 88175 Viewers
71 Video lessons · 72028 Viewers
56 Video lessons · 103820 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.