Workshop Android for Java Developers
description
Transcript of Workshop Android for Java Developers
Android Development for Java Developers
Michael Hantler
FullStack Developers Israel
April 24th 2014
Hosted by:
WHO AM I?
Working as a consultant in Android Development @ Tikal Knowledge.Extensive work in mobile HTML5-hybrid applicationsWorked for leading mobile security companies on Android/Mobile applications.
Contact: [email protected]
Michael Hantler, Lead Android
Architect
over 2 years of
Android Specific Development
WHO WE ARE?
We help companies build,deliver, deploy, manage
and optimize their products.
OUR EXPERTESE
Android Development for Java Developers
text
Prerequisite Knowledge
• Java Development (basic understanding of dev environments and UI component implementations)
Prerequisite Installs
• Eclipse• ADT plugin for Eclipse• Android SDK with at least version 4.3
Outline
Android at a GlanceUI Design via XMLActivities and FragmentsViews
Dialogs and ToastsBackwards Compatibility
Lists and Adapters
Android at a GlanceShort History of Android
Android at a GlanceAndroid Software Stacks
Android at a GlanceDevelopment Tools
Android at a GlanceGoogle’s Development References and
ToolsPackage ReferencesDevelopment Tools
Building Your First AppDeveloper Blog
Sample Apps (download through SDK manager)
Android at a GlanceHello World example
(also covering Project structure/creation/debuging/DDMS/Manifest)
Android UI via XML
Utilization
• UI can be designed for one or many screens using XML parameters and graphical previews using Android Developer Toolkit WYSIWYG editor.
• XMLs are then loaded dynamically in Java components and can be accessed/manipulated on the Java level.
Usefulness• Offers similar development to HTML and JavaScript
paradigm• Easily generate UI assets in WYSIWYG • Naming conventions allow to design XML for specific
screen sizes, orientations, Android SDK versions, languages
text
R.javatext
Android UI via XMLXML layout example (from Hello
World)
Activities and Fragments
Activities• An “application component that provides a screen with
which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map.” - Activities
• Usually tied to an xml layout that constitutes its ContentView
Fragments• Only added in Android 3.0.xx in order to deal with tablets,
but now available with backwards compatibility using Support Library
• Different concept from Activities, now need to think about aspects of each screen and not just the screen themselves in order to offer responsive design for multiple screens
text
Activity Lifecycle
Fragment Lifecycle
Intents
Description
• “An intent is an abstract description of an operation to be performed.” – Intent Reference
• Intents offer a runtime binding between Activities and Applications allowing them to be added to the different process stacks.
Example (Explicit Intent, activities need to be added to manifest)
Intent intent = new Intent(this, DisplayMessageActivity.class);intent.putExtra(EXTRA_ACTION, “warning”);this.startActivity(intent);
text
Code sample after next topic
Views“This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.). The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties.”
text
Commonly Used Views
Definitions from developer.android.com• TextView - Displays text to the user and optionally allows
them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing…
• EditText - EditText is a thin veneer over TextView that configures itself to be editable.
• Button - Represents a push-button widget. Push-buttons can be pressed, or clicked, by the user to perform an action.
• ImageView - Displays an arbitrary image, such as an icon. The ImageView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the image so that it can be used in any layout manager, and provides various display options such as scaling and tinting.
text
Commonly Used Views (continued)
Definitions from developer.android.com• ProgressBar - Visual indicator of progress in some
operation…• CheckBox - A checkbox is a specific type of two-states
button that can be either checked or unchecked. • RadioButton - A radio button is a two-states button that
can be either checked or unchecked…contrary to a CheckBox, a radio button cannot be unchecked by the user once checked.
• WebView - A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.
text
Email Fragment/Activity Example (with two buttons
instead of list)
ListViews and Adapters
ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that's placed into the list.
text
Email Fragment/Activity Example (with list)
Dialogs
A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.
text
ToastsA toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. For example, navigating away from an email before you send it triggers a "Draft saved" toast to let you know that you can continue editing later. Toasts automatically disappear after a timeout.
text
Email Fragment/Activity Example (with popups)
Support Library
The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs.
text
Including features like:• Fragments• ViewPager• DrawerLayout• ActionBar• Many more
Email Fragment/Activity Example (add Support Library
and ActionBar)
Google Play Services and Google Play Game Services
Google Play services gives you the freedom to use the newest APIs for popular Google services without worrying about device support. Updates to Google Play services are distributed automatically by the Google Play Store and new versions of the client library are delivered through the Android SDK Manager. This makes it easy for you to focus on what's important: your users' experience.
Include Services like:• Geofencing• Google Wallet• Game Leader Boards• Cloud Data• Much Much More
text
THANK YOU
Michael HantlerEmail: [email protected]