Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating a new Android project

From: Android SDK: Local Data Storage

Video: Creating a new Android project

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.

Creating a new Android project

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.

Show transcript

This video is part of

Image for Android SDK: Local Data Storage
Android SDK: Local Data Storage

29 video lessons · 5655 viewers

David Gassner
Author

 
Expand all | Collapse all
  1. 6m 34s
    1. Welcome
      50s
    2. What you should know before starting this course
      2m 11s
    3. Using the exercise files
      3m 33s
  2. 21m 6s
    1. Exploring local data storage options
      5m 58s
    2. Configuring Eclipse and the Android Developer Tools
      5m 29s
    3. Creating an Android virtual device
      3m 23s
    4. Creating a new Android project
      6m 16s
  3. 31m 30s
    1. Using preferences in Android apps
      5m 28s
    2. Defining preferences with Java
      9m 31s
    3. Defining shared preferences with an activity
      10m 50s
    4. Listening for changes to shared preferences
      5m 41s
  4. 51m 13s
    1. Creating and reading files in internal storage
      10m 18s
    2. Creating and reading JSON data files
      9m 48s
    3. Working with files in external storage
      11m 22s
    4. Parsing a read-only XML file with XmlPullParser
      11m 46s
    5. Parsing a read-only XML file with JDOM
      7m 59s
  5. 1h 8m
    1. Creating a new SQLite database
      2m 52s
    2. Defining a database with SQLiteOpenHelper
      12m 12s
    3. Managing the database with a DataSource class
      9m 38s
    4. Inserting data into a database table
      10m 29s
    5. Retrieving and displaying data
      11m 44s
    6. Importing data from XML to SQLite
      5m 15s
    7. Filtering and sorting data
      9m 27s
    8. Accessing a database from the command line
      6m 46s
  6. 42m 0s
    1. Improving the data display
      9m 29s
    2. Passing user-selected data to a detail activity
      11m 36s
    3. Working with multiple database tables
      10m 28s
    4. Deleting data from database tables
      10m 27s
  7. 49s
    1. Where to go from here
      49s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Android SDK: Local Data Storage.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.