BuildYour First Android
App
Session #1	

10 May 2014
Today’s Agenda
• Installation	

• Coffee Finder	

• Understanding Android	

• Signing Our App	

• Registering for Service	...
Agenda Continue
• Action Bars and Navigation	

• Debugging	

• Lists	

• Maps
Installation
• Java SDK 6	

• Android Studio	

• Android SDK and Stuff	

• Genymotion andVirtualBox
Why are we using Java
6?
• Android does not run the JavaVirtual
Machine, JVM	

• It runs an optimized version called the
D...
Installing Java
• Install as an Admin	

• Keep the defaults	

• Add Java bin folder to
path	

• And create
JAVA_HOME
Installing Java
• Permit the install to
make changes
Installing Java
• Click Next
Installing Java
• Once you completed
installation…	

• Add the Java bin folder
to the Path…
Installing Java
• Click Advanced system
settings
Installing Java
• Click Environment
Variables…
Installing Java
• We are going to modify
the System variables	

• Scroll up/down in the
bottom box until you
the Path	

• ...
Installing Java
• Also add a JAVA_HOME
to your system variables	

• This points to your Java
6 runtime
Installing Java
• From the command
prompt run the java
command to display the
version number	

• If all is well it will
re...
Installing Android
Studio
• Again, install as an Admin	

• Allow the install to make
changes	

• The install isn’t signed,...
Installing Android
Studio
• Accept the defaults by
clicking next
Installing Android
Studio
• Let anyone use Android
Studio
Installing Android
Studio
• Once you’ve installed
successfully, we need to
get the Android SDKs
and stuff
Installing Android
Studio
• So be sure to launch the
studio
Installing Android
Studio
• Don’t worry about this
dialog, it just gives us a
chance to upgrade old
projects
Installing Android
Studio
• Ignore this update! We
will update from the app
Installing Android
Studio
• Once you reach here,
click the tiny “Check for
updates now” link
Installing Android
Studio
• Click Update and
Restart
Installing Android
Studio
• Now that we are update,
lets get our SDKs
Installing Android
Studio
• If you see this dialog,
click Open
Installing Android
Studio
• If this screen doesn’t
come up on its own,
click the Android with
the down arrow icon	

• Sele...
Installing Android
Studio
• Accept the licenses	

• Click Install
Installing Android
Studio
• Once you see this
screen, just one more
packaged to install!
Installing Genymotion
• On Windows select the
Genymotion /VirtualBox
combo install package	

• Again, I recommend
installi...
Installing Genymotion
• Once installed, run
Genymotion	

• Click the plus sign to
add a virtual device
Installing Genymotion
• If you want to keep up
with me, choose the
Google Galaxy Nexus
Installing Genymotion
• On the virtual Google
Galaxy Nexus device	

• Drop the file: 

gapps-jb-20130813-
signed.zip	

• Yo...
Installing Genymotion
• Once you get to here,
you will need to reboot
the virtual device by
powering it down, then
up
Installing Genymotion
• The first time booting
completely up, it should
ask for you Google
account
Coffee Finder
• This is our app	

• It is a small but full
featured app	

• It uses lists, maps, the
action bar, tasks, 3r...
Coffee Finder
• Click the new project
button	

• Fill in the blanks	

• Use your own domain
name!	

• Click Next
Coffee Finder
• Just click Next here
Coffee Finder
• Change the Activity
Name	

• And the Layout Name	

• Click Next
Coffee Finder
• In order to run our app,
click the run button,
which looks like a green
arrow at top near the
center of th...
Coffee Finder
• If you get the Choose
Device dialog, be sure to
to select Use same
device…	

• Click OK
• logcat shows us logging
messages from the
device	

• And there are a lot of
messages…	

• Luckily we can filter
them
logc...
Understanding Android
• Android Open Source Project 	

• Alphabet Soup	

• Project Structure	

• Pages	

• The Application...
The Android Open
Source Project
• Android as we think of it is composed of
two parts:	

• The Android Open Source Project	...
Alphabet Soup
• ADB - Android Debug Bridge	

• ADT - Android Developer Tools	

• AVD - AndroidVirtual Device	

• DDMS - Da...
Project Structure
• AndroidManifest.xml	

• bin - executable	

• libs - libraries	

• res - resources	

• src - source files
AndroidManifest.xml
• Every application must have one in the root
directory	

• Presents essential app information to the
...
AndroidManifest.xml
• It is a XML document	

• All elements must close	

• Elements contain attributes and data	

• The ro...
AndroidManifest.xml
• Application tag	

• Activities and Services	

• Permissions	

• Meta-data
Pages
• Activity	

• Fragments
The Application Object
• A base class for those who need to
maintain global application state	

• You provide its name in ...
Coffee Finder
• Here’s what we got so
far…	

• We’ve got a lot of work
to do
Signing Our App
• In order to use Google Maps, we need to
know our apps two signatures	

• One for debug, which we will ge...
Registering for Services
• Google Maps Android	

• http://bit.ly/1jsfeJc	

• Registering withYP.com	

• http://publisher.y...
Designing Our
UI
I don’t do anything fancy. Just
plain 3x5 cards. Makes it easy to
make changes and to play my
design. 	

...
Designing Our
UI
Here is the map page.
Designing Our
UI
The details page.
Designing Our
UI
And finally the settings page.
The Action Bar
• The Action Bar will be are primary UI.	

• We will use it to move between the listings
page and the map p...
Our 2nd Page
• Create the MapActivity	

• Create the map layout	

• Register the new activity in the manifest	

• Launch n...
Create the Application
Object
• Create the Application object	

• Register the Application object in the
manifest	

• Set ...
Create the Constants
Class
• Create the Constants class	

• Add LOG_TAG to it
Calling a Web Services
• Make a direct calls toYP from DHC	

• Describe all of the objects in it	

• Create a class for ea...
Converting JSON to
POJO
• Introduction to GSON 	

• How does GSON work?	

• Implement GSON in Code
Creating a ListView
• Add the ListView to the layout	

• Create a row 	

• Creating the ListAdapter	

• Watching the ListV...
More Map Activity
• Returning to the Listings Activity	

• Via the Action Bar	

• Via the Back button
Rendering a Map
• A Simple Map	

• Positioning the Camera	

• Adding the user’s location	

• Adding Markers to the Map
Summary Session #1
• Google Maps	

• Android Manifest	

• Activities and Fragments	

• Intents	

• AsyncTask
Upcoming SlideShare
Loading in...5
×

Build Your First Android App Session #1

3,533

Published on

The slides from the build your first android app course.

Published in: Software, Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,533
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
42
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Build Your First Android App Session #1

  1. 1. BuildYour First Android App Session #1 10 May 2014
  2. 2. Today’s Agenda • Installation • Coffee Finder • Understanding Android • Signing Our App • Registering for Service • Design Our UI
  3. 3. Agenda Continue • Action Bars and Navigation • Debugging • Lists • Maps
  4. 4. Installation • Java SDK 6 • Android Studio • Android SDK and Stuff • Genymotion andVirtualBox
  5. 5. Why are we using Java 6? • Android does not run the JavaVirtual Machine, JVM • It runs an optimized version called the DalvikVirtual Machine, DVM • Because of this the current version of Java is immaterial to Android
  6. 6. Installing Java • Install as an Admin • Keep the defaults • Add Java bin folder to path • And create JAVA_HOME
  7. 7. Installing Java • Permit the install to make changes
  8. 8. Installing Java • Click Next
  9. 9. Installing Java • Once you completed installation… • Add the Java bin folder to the Path…
  10. 10. Installing Java • Click Advanced system settings
  11. 11. Installing Java • Click Environment Variables…
  12. 12. Installing Java • We are going to modify the System variables • Scroll up/down in the bottom box until you the Path • Add the path to the Java bin folder to the end of the path
  13. 13. Installing Java • Also add a JAVA_HOME to your system variables • This points to your Java 6 runtime
  14. 14. Installing Java • From the command prompt run the java command to display the version number • If all is well it will respond: javac 1.6.0_45
  15. 15. Installing Android Studio • Again, install as an Admin • Allow the install to make changes • The install isn’t signed, don’t panic
  16. 16. Installing Android Studio • Accept the defaults by clicking next
  17. 17. Installing Android Studio • Let anyone use Android Studio
  18. 18. Installing Android Studio • Once you’ve installed successfully, we need to get the Android SDKs and stuff
  19. 19. Installing Android Studio • So be sure to launch the studio
  20. 20. Installing Android Studio • Don’t worry about this dialog, it just gives us a chance to upgrade old projects
  21. 21. Installing Android Studio • Ignore this update! We will update from the app
  22. 22. Installing Android Studio • Once you reach here, click the tiny “Check for updates now” link
  23. 23. Installing Android Studio • Click Update and Restart
  24. 24. Installing Android Studio • Now that we are update, lets get our SDKs
  25. 25. Installing Android Studio • If you see this dialog, click Open
  26. 26. Installing Android Studio • If this screen doesn’t come up on its own, click the Android with the down arrow icon • Select all of the indicated downloads • Click Install
  27. 27. Installing Android Studio • Accept the licenses • Click Install
  28. 28. Installing Android Studio • Once you see this screen, just one more packaged to install!
  29. 29. Installing Genymotion • On Windows select the Genymotion /VirtualBox combo install package • Again, I recommend installing as admin
  30. 30. Installing Genymotion • Once installed, run Genymotion • Click the plus sign to add a virtual device
  31. 31. Installing Genymotion • If you want to keep up with me, choose the Google Galaxy Nexus
  32. 32. Installing Genymotion • On the virtual Google Galaxy Nexus device • Drop the file: 
 gapps-jb-20130813- signed.zip • You should get this dialog • Click OK
  33. 33. Installing Genymotion • Once you get to here, you will need to reboot the virtual device by powering it down, then up
  34. 34. Installing Genymotion • The first time booting completely up, it should ask for you Google account
  35. 35. Coffee Finder • This is our app • It is a small but full featured app • It uses lists, maps, the action bar, tasks, 3rd party web services, and more
  36. 36. Coffee Finder • Click the new project button • Fill in the blanks • Use your own domain name! • Click Next
  37. 37. Coffee Finder • Just click Next here
  38. 38. Coffee Finder • Change the Activity Name • And the Layout Name • Click Next
  39. 39. Coffee Finder • In order to run our app, click the run button, which looks like a green arrow at top near the center of the IDE • Next to it is the debug button which we will also use a lot
  40. 40. Coffee Finder • If you get the Choose Device dialog, be sure to to select Use same device… • Click OK
  41. 41. • logcat shows us logging messages from the device • And there are a lot of messages… • Luckily we can filter them logcat
  42. 42. Understanding Android • Android Open Source Project • Alphabet Soup • Project Structure • Pages • The Application Object • Intents
  43. 43. The Android Open Source Project • Android as we think of it is composed of two parts: • The Android Open Source Project • Google Services
  44. 44. Alphabet Soup • ADB - Android Debug Bridge • ADT - Android Developer Tools • AVD - AndroidVirtual Device • DDMS - Dalvik Debug Monitor Server
  45. 45. Project Structure • AndroidManifest.xml • bin - executable • libs - libraries • res - resources • src - source files
  46. 46. AndroidManifest.xml • Every application must have one in the root directory • Presents essential app information to the Android system • Activities, services, the application object must all be defined in it • It also controls the look of some elements
  47. 47. AndroidManifest.xml • It is a XML document • All elements must close • Elements contain attributes and data • The root element is the Manifest tag
  48. 48. AndroidManifest.xml • Application tag • Activities and Services • Permissions • Meta-data
  49. 49. Pages • Activity • Fragments
  50. 50. The Application Object • A base class for those who need to maintain global application state • You provide its name in the AndroidManifest file • The Application object created before any activity or service • When destroyed, app is finished
  51. 51. Coffee Finder • Here’s what we got so far… • We’ve got a lot of work to do
  52. 52. Signing Our App • In order to use Google Maps, we need to know our apps two signatures • One for debug, which we will get now • And one for release, will do that next week
  53. 53. Registering for Services • Google Maps Android • http://bit.ly/1jsfeJc • Registering withYP.com • http://publisher.yp.com
  54. 54. Designing Our UI I don’t do anything fancy. Just plain 3x5 cards. Makes it easy to make changes and to play my design. Here is the design of the listings page.
  55. 55. Designing Our UI Here is the map page.
  56. 56. Designing Our UI The details page.
  57. 57. Designing Our UI And finally the settings page.
  58. 58. The Action Bar • The Action Bar will be are primary UI. • We will use it to move between the listings page and the map page • And to go to the settings page • Drilling down on either listings or map pages takes you to the details page
  59. 59. Our 2nd Page • Create the MapActivity • Create the map layout • Register the new activity in the manifest • Launch new activity from the old one
  60. 60. Create the Application Object • Create the Application object • Register the Application object in the manifest • Set breakpoint to see it in action
  61. 61. Create the Constants Class • Create the Constants class • Add LOG_TAG to it
  62. 62. Calling a Web Services • Make a direct calls toYP from DHC • Describe all of the objects in it • Create a class for each object • Avoiding ANR • Create an AsyncTask to load the data
  63. 63. Converting JSON to POJO • Introduction to GSON • How does GSON work? • Implement GSON in Code
  64. 64. Creating a ListView • Add the ListView to the layout • Create a row • Creating the ListAdapter • Watching the ListView get filled • Drilling to a list item
  65. 65. More Map Activity • Returning to the Listings Activity • Via the Action Bar • Via the Back button
  66. 66. Rendering a Map • A Simple Map • Positioning the Camera • Adding the user’s location • Adding Markers to the Map
  67. 67. Summary Session #1 • Google Maps • Android Manifest • Activities and Fragments • Intents • AsyncTask
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×