Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.
Android Bootcamp Week 1
Transcript of Android Bootcamp Week 1
design by Dóri Sirály for Prezi
You've created a new Android App
What the heck is all this stuff?
Running the App
in the Genymotion Emulator
Exercise 1: Explore the Lifecycle
Run the newly created application on the
activity to a new controller package
Code > Generate
to generate overrides for
onDestroy(), onStart(), onStop(), onPause(), onResume()
Add a log statement to each of these as well as
Log.d("lifecycle", "HelloAndroid <method>");
to the "
" tag, then explore when these messages are produced. What happens when you change from portrait to landscape?
You've dissected an Android and seen:
You've run your app on an emulator
You've created your own activity so the user can enter their name
You've explored the Android life-cycle
Develop a working Android app and explore its anatomy.
Allow the user to enter their name.
Next week on
Behaviour Driven Development
What did we do well?
What could we do better?
What puzzles you?
Why are we here?
To learn about Android application development together
To build a simple game incrementally over six weeks
Score points by finding 'treasures' in our local area
The Android Activity Life-Cycle
for the Play store
Resources: Static files
to be packaged
with the app
These form the
and exist to
: Images in various
resolutions for different screen densities.
allow you to control how images get stretched. Extension is .9.png
You can use image files from the platforms/data/res directory of the Android SDK under the Apache License 2.0, or create your own with the help of the
Android Asset Studio
The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.
describe in xml how the various
in your app appear on screen.
Reuse parts of pages with
are also described in xml.
allows you to name sizes of things. Best practice is to use
(scale independent pixels) for font sizes,
(density independent pixels) for everything else.
allows you to name string resources
allows you to define sets of styling to be applied to screen elements.
can be inherited.
Directory suffixes allow you to override view elements for different devices and locales, eg
for a dimens.xml for screens more than 820dp wide
for a French version of
for a landscape version of a
for a large screen version of a
is the tool used to package up your application so it can be delivered to your device.
When you make changes to your project settings (eg dependencies) through Studio, those settings are saved in the
files as well as in the
Studio project files (.idea and .iml files).
files should be checked in to source control, project files should not.
configures the app as a whole, and each
must be listed in the
directory holds generated files including
, a class that provides references to all resources.
holds your Java classes. Android Studio creates the first one for you. It's an
are descendants of
. They are
that orchestrate the flow of control between screens of your app. Keep the code in these as brief as possible. Business logic should be delegated to
to progress from one
is a description of an action to be performed, together with data relevant to the action.
Exercise 2: Create a Second Activity
File > New > Activity
to open the
on the first page. Fill in the second page like this:
Exercise 3: Capture the Player's Name
to the layout for
, where we'll display a welcome message that includes the player's name. This is NOT best practice. The
should be in the
. We'll cover that in a later week.
Add a new Java class called '
' in a new package called
com.<your package name>.androidbootcamp.model
Add a String field '
' with a getter and a constructor that takes the player's name as a parameter.
Add a field to the
. This will hold all the state for the current game, including the player's name.
, open the new activity using
that retrieves the name from the
, and uses it to create a new
Exercise 4: Keep the game state safe
What happens if you switch from portrait to landscape?
To stop the game state from being lost when the activity is recreated, we have to save and restore the instance state.
(for good performance this should be
instead, but that adds complexity)
to save the game in the
to restore the game
Restore the text of the
Add debug logging to the
events of the
activity to explore how the lifecycles interact.
What happens if you click the
key then re-open the application. What if you click the
Explore the files that are created. Try running the app. Fix the compile errors.
We will use the new activity to allow the player to enter their name and return it to the first activity:
In the layout for the new activity, add a
handler to the button that returns the name entered by the player