SlideShare une entreprise Scribd logo
1  sur  44
Beginning Native Android Apps
Gil Irizarry
Conoa, Inc.
Your logo on white
centered in this space
Launched VC News Daily app on iOS and Android. Over 3000
downloads so far. Also, check out @wazareapp.
Owner and lead engineer at Conoa, a graphics and mobile software firm
gil@conoa.com
http://www.slideshare.net/conoagil/
About Me
All examples and sample code in this presentation can be found at:
http://conoa.com/hidden/sig2015examples.zip
About Me
There are nearly 4 million mobile apps available today.
http://www.statista.com/statistics/276623/number-of-apps-available-in-
leading-app-stores/
In 2015, there will be approximately 180 billion app downloads.
http://www.statista.com/statistics/266488/forecast-of-mobile-app-
downloads/
For many, interacting with software means interacting with mobile
devices (or at least devices that run mobile software).
Why?
Learn some basic Android concepts
Look at the structure of an Android app
Access the device
Do some rendering
What we will do
Android 1.5 – Cupcake
Android 1.6 – Donut
Android 2.0 – Eclair, HTML5 support, Bluetooth 2.1
Android 2.2 – Froyo, USB tethering and WiFi hotspot functionality
Android 2.3 – Gingerbread, aimed at tablets, support for large screens
Android 3.0 – Honeycomb, 3D desktop, better tablet support
Android 4.0 – Ice Cream Sandwich
Android 4.1 – Jelly Bean
Android 4.3 – KitKat
Android 5.0 – Lollipop
Android M – developer preview currently
https://en.wikipedia.org/wiki/Android_version_history
Android Versions
https://upload.wikimedia.org/wikipedia/commons/a/af/Android-System-Architecture.svg
The Android Stack
The android stack, from top to bottom:
Applications: app built with the Java framework
Android framework: com.android….
Dalvik VM: for running Java code
Native framework: native code
Linux kernel
The Android Stack
As a developer, you can choose to develop with the SDK or NDK.
Android SDK – provides the framework
Android NDK – for compiling to native code
Android ADB – (android debug bridge) the emulator and debugger
Android Eclipse Plug-in
Android Studio
Android Development
Example 1 - Hello World
Manifest
- An Android app must list the set of permissions it needs and device
capabilities it will use. This list is contained in the manifest file. The
manifest file allows the user to understand what capabilities an app has
when installing it.
The structure of an app
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.siggraph2015.example1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion=”8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=”com.siggraph2015.example1.FirstActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
The structure of an app
Activities and intents
- An Android activity maps to a user screen. If you had an app with
a splash screen, a menu and news reader, that app would have 3
activities. An activity is a class that you subclass to modify.
- Intents connect activities. They allow control to flow from one
screen to another.
The structure of an app
https://upload.wikimedia.org/wikipedia/en/f/f6/Android_application_life_cycle.png
Activity lifecycle
Views
- An Android activity contains a layout with one or more views.
Views allow presenting information to the user. Widgets are subclasses
of views and have specialized behavior. Examples of widgets are:
- Lists
- Buttons
- Images
- Dialog boxes
The structure of an app
Example 2 - Layouts
Before running Example 2, do the following:
cd C:Program Fileseclipseplatform-tools
adb shell
su
mount -o rw,remount rootfs /
chmod 777 /mnt/sdcard
exit
exit
adb push pic1.jpg /sdcard
adb push pic2.jpg /sdcard
Example 2 - Prep the emulator
Example 2 - Prep the emulator
Views allow drawing and event handling for a region of the screen.
Groups are a subclass of a View that allows organization of Views.
Layouts are subclasses of Groups that add properties to Groups.
Layouts may contain other layouts.
Layouts
Linear Layout - aligns all children in a single direction, vertically or
horizontally.
Relative Layout - displays child views in relative positions.
Table Layout - groups views into rows and columns.
Absolute Layout - enables you to specify the exact location of its
children.
Frame Layout - placeholder on screen that you can use to display a
single view.
List View - displays a list of scrollable items.
Grid View - displays items in a two-dimensional, scrollable grid.
Layouts
<RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
android:layout_width="match_parent”
android:layout_height="match_parent”
android:background="@android:color/white" >
<ImageView
android:id="@+id/imageView1”
android:src="@drawable/siglogo" />
<ImageView
android:id="@+id/imageView2”
android:layout_below="@+id/imageView1”
android:layout_toRightOf="@+id/imageView1”
android:scaleType="fitXY”
android:src="@drawable/lacc" />
<LinearLayout
android:layout_below="@+id/text1”>
<Button
Layouts
Example 3 - Input / internet access
Need to set permissions in the manifest file that are needed by the app:
<uses-permission android:name="android.permission.INTERNET" />
Set callbacks in the layout file:
<Button
android:onClick="clearSubmit” />
<Button
android:onClick="symbolSubmit” />
Permissions and actions
Intents pass control between activities. Data can be added to them to
be consumed by the target activity. Do this with an “extra”. Extras are
simply key/value pairs.
Intent thisIntent = new Intent(mContext, DisplayQuote.class);
thisIntent.putExtra("symbol", editText.getText().toString());
startActivity(thisIntent);
In the target activity:
Bundle bundle = this.getIntent().getExtras();
mSymbol = bundle.getString("symbol");
In the code, the symbol is used to construct the URL for HTTP request.
Data Passing between activities
Example 4 - Contact Lists
Make sure to add some contacts to the emulator.
Example 4 - Prep the emulator
Need to set permissions in the manifest file that are needed by the app:
<uses-permission
android:name="android.permission.READ_CONTACTS" />
Set callbacks in the layout file:
<Button
android:onClick="clearSubmit” />
<Button
android:onClick="symbolSubmit” />
Permissions
Content providers manage access to a structured set of data. They
encapsulate the data, and provide mechanisms for defining data
security.
When you want to access data in a content provider, you use the
ContentResolver object in your application's Context to communicate
with the provider as a client.
Cursors provide random read-write access to the result set returned by
a database. The example uses a Cursor to loop over the data returned
from a query of the Resolver.
Providers, Resolvers and Cursors
Example 5 - Scrollable lists
ListView can be used to give the appearance of an infinitely scrollable
list:
Define a ListView in the activity layout.
Define a class for each ListView item, and create associated layout.
Define an adapter to bind the ListView to the item class.
We are able to set a listener on each ListView item:
listView.setOnItemClickListener(new OnItemClickListener()
Scrollable Lists
In addition to ListView, there is also ExpandableListView.
In ExpandableListView, each list item will open to reveal a larger layout
when touched.
Expandable List Items
Example 6 - access GPS location
Make sure to add some contacts to the emulator.
Example 4 - Prep the emulator
Example 4 - Prep the emulator
Need to set permissions in the manifest file that are needed by the app:
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
Permissions
Need to implement a LocationListener:
public class GetLocation extends Activity implements
LocationListener {
Then the app can be called when the location changes:
public void onLocationChanged(Location location) {
txtLat = (TextView) findViewById(R.id.locationview);
txtLat.setText("Latitude:" + location.getLatitude() + ",
Longitude:" + location.getLongitude());
}
LocationListener
Example 7 - using the camera
Need to set permissions in the manifest file that are needed by the app:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Permissions
A subclass of SurfaceView gets the camera and starts previewing.
The activity binds that SurfaceView to the FrameLayout defined in the
layout file.
In the example, the listener on the button forces the camera to take a
picture, calling the camera callback method for taking a picture. Here
we can get the raw bitmap of the image.
What if we wanted to do image processing on preview?
Previewing the Camera
Example 8 - OpenGL rendering
Android bundles OpenGL ES – OpenGL for Embedded Systems
Since Android 2.2, there has been support for OpenGL ES 1.0. Later
versions of Android support OpenGL ES 2.0. You can query the
platform to see which version of OpenGL ES is supported and make the
appropriate rendering calls.
OpenGL rendering
The activity is bound to a surface. The surface is what gets drawn and
receives events.
The surface is bound to a renderer. The renderer contains the code for
rendering.
OpenGL rendering
The example code calls queueEvent when wanting to render.
This is needed because GLSurfaceView creates a separate rendering
thread. You can’t make rendering calls directly in the UI thread.
queueEvent queues request from other threads to the surface thread for
rendering.
Why queueEvent?
Set version in the manifest file
Build the .apk file
Digitally sign it
Create developer account
Upload to Google Play developer console
Submitting to the App Store

Contenu connexe

Tendances

Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek Bhusal
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)Oum Saokosal
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial IntroPamela Fox
 
Developing accessible android applications
Developing accessible android applicationsDeveloping accessible android applications
Developing accessible android applicationsRenato Iwashima
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QATed Drake
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & LayoutsVijay Rastogi
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetPrajyot Mainkar
 
Multiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerMultiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerAhsanul Karim
 
Demystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirDemystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirHirday Lamba
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseEPAM Systems
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfacesC.o. Nieto
 
One Weekend With AngularJS
One Weekend With AngularJSOne Weekend With AngularJS
One Weekend With AngularJSYashobanta Bai
 

Tendances (20)

Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
 
Developing accessible android applications
Developing accessible android applicationsDeveloping accessible android applications
Developing accessible android applications
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QA
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & Layouts
 
View groups containers
View groups containersView groups containers
View groups containers
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection Widget
 
Multiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerMultiple Activity and Navigation Primer
Multiple Activity and Navigation Primer
 
Modern android development
Modern android developmentModern android development
Modern android development
 
Android layouts
Android layoutsAndroid layouts
Android layouts
 
Demystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirDemystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using Watir
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Unit2
Unit2Unit2
Unit2
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
One Weekend With AngularJS
One Weekend With AngularJSOne Weekend With AngularJS
One Weekend With AngularJS
 
Angular js
Angular jsAngular js
Angular js
 
Angular material
Angular materialAngular material
Angular material
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 

Similaire à Beginning Native Android Apps

Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in androidInnovationM
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development PracticesRoy Clarkson
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfAbdullahMunir32
 
Android Apps Development Basic
Android Apps Development BasicAndroid Apps Development Basic
Android Apps Development BasicMonir Zzaman
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureVijay Rastogi
 
Introduction to Android Programming
Introduction to Android ProgrammingIntroduction to Android Programming
Introduction to Android ProgrammingRaveendra R
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivitiesmaamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activitiesmaamir farooq
 
Android Tutorial
Android TutorialAndroid Tutorial
Android TutorialFun2Do Labs
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbitCarWash1
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-TejamFandat
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in androidMahmudul Hasan
 
android level 3
android level 3android level 3
android level 3DevMix
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidDenis Minja
 

Similaire à Beginning Native Android Apps (20)

Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
 
Android Apps Development Basic
Android Apps Development BasicAndroid Apps Development Basic
Android Apps Development Basic
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
 
Introduction to Android Programming
Introduction to Android ProgrammingIntroduction to Android Programming
Introduction to Android Programming
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbit
 
android layouts
android layoutsandroid layouts
android layouts
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
 
Hello Android
Hello AndroidHello Android
Hello Android
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 
android level 3
android level 3android level 3
android level 3
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 

Plus de Gil Irizarry

A Rose By Any Other Name.pdf
A Rose By Any Other Name.pdfA Rose By Any Other Name.pdf
A Rose By Any Other Name.pdfGil Irizarry
 
[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...
[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...
[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...Gil Irizarry
 
[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...
[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...
[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...Gil Irizarry
 
Ai for Good: Bad Guys, Messy Data, & NLP
Ai for Good: Bad Guys, Messy Data, & NLPAi for Good: Bad Guys, Messy Data, & NLP
Ai for Good: Bad Guys, Messy Data, & NLPGil Irizarry
 
DevSecOps Orchestration of Text Analytics with Containers
DevSecOps Orchestration of Text Analytics with ContainersDevSecOps Orchestration of Text Analytics with Containers
DevSecOps Orchestration of Text Analytics with ContainersGil Irizarry
 
Towards Identity Resolution: The Challenge of Name Matching
Towards Identity Resolution: The Challenge of Name MatchingTowards Identity Resolution: The Challenge of Name Matching
Towards Identity Resolution: The Challenge of Name MatchingGil Irizarry
 
RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...
RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...
RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...Gil Irizarry
 
From Silos to DevOps: Our Story
From Silos to DevOps:  Our StoryFrom Silos to DevOps:  Our Story
From Silos to DevOps: Our StoryGil Irizarry
 
Graphics on the Go
Graphics on the GoGraphics on the Go
Graphics on the GoGil Irizarry
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps QuicklyGil Irizarry
 
Building The Agile Enterprise - LSSC '12
Building The Agile Enterprise - LSSC '12Building The Agile Enterprise - LSSC '12
Building The Agile Enterprise - LSSC '12Gil Irizarry
 
Agile The Kanban Way - Central MA PMI 2011
Agile The Kanban Way - Central MA PMI 2011Agile The Kanban Way - Central MA PMI 2011
Agile The Kanban Way - Central MA PMI 2011Gil Irizarry
 
Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011
Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011
Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011Gil Irizarry
 
Transitioning to Kanban - Aug 11
Transitioning to Kanban - Aug 11Transitioning to Kanban - Aug 11
Transitioning to Kanban - Aug 11Gil Irizarry
 
Transitioning to Kanban
Transitioning to KanbanTransitioning to Kanban
Transitioning to KanbanGil Irizarry
 
Beyond Scrum of Scrums
Beyond Scrum of ScrumsBeyond Scrum of Scrums
Beyond Scrum of ScrumsGil Irizarry
 

Plus de Gil Irizarry (16)

A Rose By Any Other Name.pdf
A Rose By Any Other Name.pdfA Rose By Any Other Name.pdf
A Rose By Any Other Name.pdf
 
[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...
[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...
[Apple-organization] and [oranges-fruit] - How to evaluate NLP tools - Basis ...
 
[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...
[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...
[Apple|organization] and [oranges|fruit]: How to evaluate NLP tools for entit...
 
Ai for Good: Bad Guys, Messy Data, & NLP
Ai for Good: Bad Guys, Messy Data, & NLPAi for Good: Bad Guys, Messy Data, & NLP
Ai for Good: Bad Guys, Messy Data, & NLP
 
DevSecOps Orchestration of Text Analytics with Containers
DevSecOps Orchestration of Text Analytics with ContainersDevSecOps Orchestration of Text Analytics with Containers
DevSecOps Orchestration of Text Analytics with Containers
 
Towards Identity Resolution: The Challenge of Name Matching
Towards Identity Resolution: The Challenge of Name MatchingTowards Identity Resolution: The Challenge of Name Matching
Towards Identity Resolution: The Challenge of Name Matching
 
RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...
RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...
RapidMiner - Don’t Forget to Pack Text Analytics on Your Data Exploration Jou...
 
From Silos to DevOps: Our Story
From Silos to DevOps:  Our StoryFrom Silos to DevOps:  Our Story
From Silos to DevOps: Our Story
 
Graphics on the Go
Graphics on the GoGraphics on the Go
Graphics on the Go
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps Quickly
 
Building The Agile Enterprise - LSSC '12
Building The Agile Enterprise - LSSC '12Building The Agile Enterprise - LSSC '12
Building The Agile Enterprise - LSSC '12
 
Agile The Kanban Way - Central MA PMI 2011
Agile The Kanban Way - Central MA PMI 2011Agile The Kanban Way - Central MA PMI 2011
Agile The Kanban Way - Central MA PMI 2011
 
Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011
Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011
Transitioning to Kanban: Theory and Practice - Project Summit Boston 2011
 
Transitioning to Kanban - Aug 11
Transitioning to Kanban - Aug 11Transitioning to Kanban - Aug 11
Transitioning to Kanban - Aug 11
 
Transitioning to Kanban
Transitioning to KanbanTransitioning to Kanban
Transitioning to Kanban
 
Beyond Scrum of Scrums
Beyond Scrum of ScrumsBeyond Scrum of Scrums
Beyond Scrum of Scrums
 

Dernier

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Dernier (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

Beginning Native Android Apps

  • 1. Beginning Native Android Apps Gil Irizarry Conoa, Inc. Your logo on white centered in this space
  • 2. Launched VC News Daily app on iOS and Android. Over 3000 downloads so far. Also, check out @wazareapp. Owner and lead engineer at Conoa, a graphics and mobile software firm gil@conoa.com http://www.slideshare.net/conoagil/ About Me
  • 3. All examples and sample code in this presentation can be found at: http://conoa.com/hidden/sig2015examples.zip About Me
  • 4. There are nearly 4 million mobile apps available today. http://www.statista.com/statistics/276623/number-of-apps-available-in- leading-app-stores/ In 2015, there will be approximately 180 billion app downloads. http://www.statista.com/statistics/266488/forecast-of-mobile-app- downloads/ For many, interacting with software means interacting with mobile devices (or at least devices that run mobile software). Why?
  • 5. Learn some basic Android concepts Look at the structure of an Android app Access the device Do some rendering What we will do
  • 6. Android 1.5 – Cupcake Android 1.6 – Donut Android 2.0 – Eclair, HTML5 support, Bluetooth 2.1 Android 2.2 – Froyo, USB tethering and WiFi hotspot functionality Android 2.3 – Gingerbread, aimed at tablets, support for large screens Android 3.0 – Honeycomb, 3D desktop, better tablet support Android 4.0 – Ice Cream Sandwich Android 4.1 – Jelly Bean Android 4.3 – KitKat Android 5.0 – Lollipop Android M – developer preview currently https://en.wikipedia.org/wiki/Android_version_history Android Versions
  • 8. The android stack, from top to bottom: Applications: app built with the Java framework Android framework: com.android…. Dalvik VM: for running Java code Native framework: native code Linux kernel The Android Stack
  • 9. As a developer, you can choose to develop with the SDK or NDK. Android SDK – provides the framework Android NDK – for compiling to native code Android ADB – (android debug bridge) the emulator and debugger Android Eclipse Plug-in Android Studio Android Development
  • 10. Example 1 - Hello World
  • 11. Manifest - An Android app must list the set of permissions it needs and device capabilities it will use. This list is contained in the manifest file. The manifest file allows the user to understand what capabilities an app has when installing it. The structure of an app
  • 12. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.siggraph2015.example1" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion=”8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=”com.siggraph2015.example1.FirstActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> </manifest> The structure of an app
  • 13. Activities and intents - An Android activity maps to a user screen. If you had an app with a splash screen, a menu and news reader, that app would have 3 activities. An activity is a class that you subclass to modify. - Intents connect activities. They allow control to flow from one screen to another. The structure of an app
  • 15. Views - An Android activity contains a layout with one or more views. Views allow presenting information to the user. Widgets are subclasses of views and have specialized behavior. Examples of widgets are: - Lists - Buttons - Images - Dialog boxes The structure of an app
  • 16. Example 2 - Layouts
  • 17. Before running Example 2, do the following: cd C:Program Fileseclipseplatform-tools adb shell su mount -o rw,remount rootfs / chmod 777 /mnt/sdcard exit exit adb push pic1.jpg /sdcard adb push pic2.jpg /sdcard Example 2 - Prep the emulator
  • 18. Example 2 - Prep the emulator
  • 19. Views allow drawing and event handling for a region of the screen. Groups are a subclass of a View that allows organization of Views. Layouts are subclasses of Groups that add properties to Groups. Layouts may contain other layouts. Layouts
  • 20. Linear Layout - aligns all children in a single direction, vertically or horizontally. Relative Layout - displays child views in relative positions. Table Layout - groups views into rows and columns. Absolute Layout - enables you to specify the exact location of its children. Frame Layout - placeholder on screen that you can use to display a single view. List View - displays a list of scrollable items. Grid View - displays items in a two-dimensional, scrollable grid. Layouts
  • 21. <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width="match_parent” android:layout_height="match_parent” android:background="@android:color/white" > <ImageView android:id="@+id/imageView1” android:src="@drawable/siglogo" /> <ImageView android:id="@+id/imageView2” android:layout_below="@+id/imageView1” android:layout_toRightOf="@+id/imageView1” android:scaleType="fitXY” android:src="@drawable/lacc" /> <LinearLayout android:layout_below="@+id/text1”> <Button Layouts
  • 22. Example 3 - Input / internet access
  • 23. Need to set permissions in the manifest file that are needed by the app: <uses-permission android:name="android.permission.INTERNET" /> Set callbacks in the layout file: <Button android:onClick="clearSubmit” /> <Button android:onClick="symbolSubmit” /> Permissions and actions
  • 24. Intents pass control between activities. Data can be added to them to be consumed by the target activity. Do this with an “extra”. Extras are simply key/value pairs. Intent thisIntent = new Intent(mContext, DisplayQuote.class); thisIntent.putExtra("symbol", editText.getText().toString()); startActivity(thisIntent); In the target activity: Bundle bundle = this.getIntent().getExtras(); mSymbol = bundle.getString("symbol"); In the code, the symbol is used to construct the URL for HTTP request. Data Passing between activities
  • 25. Example 4 - Contact Lists
  • 26. Make sure to add some contacts to the emulator. Example 4 - Prep the emulator
  • 27. Need to set permissions in the manifest file that are needed by the app: <uses-permission android:name="android.permission.READ_CONTACTS" /> Set callbacks in the layout file: <Button android:onClick="clearSubmit” /> <Button android:onClick="symbolSubmit” /> Permissions
  • 28. Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. When you want to access data in a content provider, you use the ContentResolver object in your application's Context to communicate with the provider as a client. Cursors provide random read-write access to the result set returned by a database. The example uses a Cursor to loop over the data returned from a query of the Resolver. Providers, Resolvers and Cursors
  • 29. Example 5 - Scrollable lists
  • 30. ListView can be used to give the appearance of an infinitely scrollable list: Define a ListView in the activity layout. Define a class for each ListView item, and create associated layout. Define an adapter to bind the ListView to the item class. We are able to set a listener on each ListView item: listView.setOnItemClickListener(new OnItemClickListener() Scrollable Lists
  • 31. In addition to ListView, there is also ExpandableListView. In ExpandableListView, each list item will open to reveal a larger layout when touched. Expandable List Items
  • 32. Example 6 - access GPS location
  • 33. Make sure to add some contacts to the emulator. Example 4 - Prep the emulator
  • 34. Example 4 - Prep the emulator
  • 35. Need to set permissions in the manifest file that are needed by the app: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> Permissions
  • 36. Need to implement a LocationListener: public class GetLocation extends Activity implements LocationListener { Then the app can be called when the location changes: public void onLocationChanged(Location location) { txtLat = (TextView) findViewById(R.id.locationview); txtLat.setText("Latitude:" + location.getLatitude() + ", Longitude:" + location.getLongitude()); } LocationListener
  • 37. Example 7 - using the camera
  • 38. Need to set permissions in the manifest file that are needed by the app: <uses-permission android:name="android.permission.CAMERA"/> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Permissions
  • 39. A subclass of SurfaceView gets the camera and starts previewing. The activity binds that SurfaceView to the FrameLayout defined in the layout file. In the example, the listener on the button forces the camera to take a picture, calling the camera callback method for taking a picture. Here we can get the raw bitmap of the image. What if we wanted to do image processing on preview? Previewing the Camera
  • 40. Example 8 - OpenGL rendering
  • 41. Android bundles OpenGL ES – OpenGL for Embedded Systems Since Android 2.2, there has been support for OpenGL ES 1.0. Later versions of Android support OpenGL ES 2.0. You can query the platform to see which version of OpenGL ES is supported and make the appropriate rendering calls. OpenGL rendering
  • 42. The activity is bound to a surface. The surface is what gets drawn and receives events. The surface is bound to a renderer. The renderer contains the code for rendering. OpenGL rendering
  • 43. The example code calls queueEvent when wanting to render. This is needed because GLSurfaceView creates a separate rendering thread. You can’t make rendering calls directly in the UI thread. queueEvent queues request from other threads to the surface thread for rendering. Why queueEvent?
  • 44. Set version in the manifest file Build the .apk file Digitally sign it Create developer account Upload to Google Play developer console Submitting to the App Store