Download Android

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Manifesto Digital Limited
Welcome to Android
Hello World!
Contents
Introduction ................................................................................................................................................... 3
Installation ...................................................................................................................................................... 3
Creating a project .......................................................................................................................................... 4
Android Virtual Device (AVD) ....................................................................................................................... 8
Lifecycle ......................................................................................................................................................... 11
Components..................................................................................................................................................12
Creating our first App...................................................................................................................................13
About Manifesto Digital .............................................................................................................................. 16
Senior team .............................................................................................................................................. 16
Simon Bates ......................................................................................................................................... 16
Jim Bowes ............................................................................................................................................ 16
Curtis Fox ............................................................................................................................................. 16
Process ........................................................................................................................................................... 17
Scrum ......................................................................................................................................................... 17
Key Scrum roles ................................................................................................................................... 18
Key Scrum artefacts ............................................................................................................................ 18
Key Scrum activities ............................................................................................................................ 18
Get in touch .................................................................................................................................................. 19
Introduction
Android is based on Java using Dalvik process virtual machine.
Why we should develop for Android?




You don’t need a Mac 
Java (community)
Faster learning Curve than iOS
Open source (iOS Bluetooth example)
Why we shouldn’t develop for Android?




Fragmentation (needs to support many APIs levels.)
Horrible Emulator (Genymotion and HACXM Intel helps)
Xcode is way better than ADT
iOS generates more money per App (around 5 times more (Forbes 8/10/2013)).
Installation
The easiest way to start working with Android is to download the ADT Bundle. This gives us
everything we need to start developing:





Eclipse + ADT plugin
Integrates everything in eclipse.
Android SDK Tools
Emulator, sdcard, sqlite…
Android Platform Tools
Support features of current android platform like ADB (bridge to communicate emulator
with device).
The latest Android platform
The latest Android system image for the emulator
http://developer.android.com/sdk/index.html#download
Extract and open eclipse from the generated folder from
“adt-bundle-<OS>/eclipse”
That’s it!
Creating a project
To create a project first, go to “File/New/Android Application Project”.



We usually set the Package Name as your website domain + your Project Name in reverse
order as it needs to be unique.
Target SDK is the highest version of Android where we have tested our application.
Compile With is set to the highest available Android version by default.
On the next screen we can leave everything as default.
Now we choose an icon and a blank activity as we are going to define it manually later on.
Next step is to choose a name for your activity (we will discuss this later on).
Now we have our project created, let’s have a quick look at the project structure of an Android
application:






Src
This contains the .java source files for your project. By default, it includes a
MainActivity.java
Gen
This contains the .R file, a compiler-generated file that references all the resources found
in your project. You should not modify this file.
Bin
This folder contains the Android package files .apk built by the ADT during the build
process and everything else needed to run an Android application.
Res/layout
This is a directory for files that define your app's user interface.
Res/values
This is a directory for other various XML files that contain a collection of resources, such
as strings and colors definitions.
AndroidManifest.xml
This is the manifest file, which describes the fundamental characteristics of the app and
defines each of its components.
Android Virtual Device (AVD)
A “Hello World App” is already implemented by default when you create a project. We can run it
either by running on our own device (we might need to install drivers for that) or we can run it
using the Android Emulator.
First we need to create an “AVD”
On Eclipse click on the ADB button/New and we fill in the information of a new device.
Now select a device and start it. It might take a while, as it can be quite slow to launch
(something as long as several minutes). Once launched it should look something like this:
Now all we have to do is run the application: Right-click the project and select run as android
application. We should now see the hello World App on the screen.
Lifecycle
When the Activity loads for the first time, the events are named as follows:
1. onCreate();
2. onStart();
3. onResume();
When you click on the Phone button, the Activity goes to the background and the below events
are called:
1. onPause();
2. onStop();
Exit the phone dialer and the following events will be called:
1. onRestart();
2. onStart();
3. onResume();
When you click the back button OR try to finish() the activity the events are called as follows:
1. onPause();
2. onStop();
3. onDestroy()
Components
Application Components

Activity: An activity is a screen with which the user interacts. An application can have
several activities, but only one can be in an active state at a time.

Broadcast Receiver: A broadcast receiver can be registered to listen to system messages
and intents. A receiver is notified by the Android system if the specified event occurs. For
example, you can register for the event that the state of the phone changes, e.g.,
someone is calling.

Content Provider: A content provider defines a structured interface to application data. A
provider can be used for accessing data within one application, but can also be used to
share data with other applications.
Android contains an SQLite database which is frequently used in conjunction with a
content provider. The SQLite database would store the data, which would be accessed via
the provider.

Services: A Service is something that does not require a user interface. It performs its
operations without user interaction in the background but won’t be initiated without user
invocation. Another component such as an activity should invoke. A service does not
have an independent thread, they make use of the main thread from hosting process. For
instance you can download something while you get involved in some other application,
where download is a service running in background.
Interface Components





Fragment: A Fragment is a portion of your activity, which enables you to divide your
activity for modular design. Each fragment is an independent module that is tightly bound
to the Activity into which it is placed. Each of these fragments have their own life-cycle
and UI, however a fragment's life-cycle is directly affected by the host's activity life-cycle.
Intent: Intents are messages that allow components to request activities from other
components. If an activity were to require another activity to perform some functionality
this would be achieved via an intent.
Views and layout manager: Views are user interface widgets, e.g., buttons or text fields.
Views have attributes which can be used to configure their appearance and behaviour.
A ViewGroup is responsible for arranging other views. It is also known as layout manager.
The base class for these layout managers is the android.view.ViewGroup class which
extends the android.view.View class which is the base class for views. Layout managers
can be nested to create complex layouts.
Creating our first App
activity_tutorial _main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/textViewId"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textColor="#c00000"
/>
<Button
android:id="@+id/buttonStart"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Start"/>
<Button
android:id="@+id/buttonStop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stop"/>
</LinearLayout>
tutorial main activity
package uk.co.manifesto.tutorialapp;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class TutorialMainActivity extends Activity {
private static String logtag = "TutorialMainActivity";//for use as the tag when
logging
private int addStart = 0;
private int addStop = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutorial_main);
TextView textView = (TextView)findViewById(R.id.textViewId);
textView.setText("This is a text view");
Button buttonStart = (Button)findViewById(R.id.buttonStart);
buttonStart.setOnClickListener(startListener); // Register the onClick listener
with the implementation above
Button buttonStop = (Button)findViewById(R.id.buttonStop);
buttonStop.setOnClickListener(stopListener); // Register the onClick listener with
the implementation above
}
//Create an anonymous implementation of OnClickListener
private OnClickListener startListener = new OnClickListener() {
public void onClick(View v) {
Log.d(logtag,"onClick() called - start button");
addStart++;
Toast.makeText(TutorialMainActivity.this, "Number of times the Start button
was clicked: " + addStart, Toast.LENGTH_LONG).show();
Log.d(logtag,"onClick() ended - start button");
}
};
// Create an anonymous implementation of OnClickListener
private OnClickListener stopListener = new OnClickListener() {
public void onClick(View v) {
Log.d(logtag,"onClick() called - stop button");
addStop++;
Toast.makeText(TutorialMainActivity.this, "Number of times the Stop
button was clicked: " + addStop, Toast.LENGTH_LONG).show();
Log.d(logtag,"onClick() ended - stop button");
}
};
About Manifesto Digital
We are Manifesto. A full service digital agency, based in London, founded in 2011 by three former
colleagues aiming to make the company they’d like to work for.
We aim to bring clever creative and technical people together, and give them the space and tools
they need to channel their energy and passion.
We make people’s lives better, easier, fairer, more interesting and fun through the use of
technology.
We believe in doing this we will deliver for our customers, their customers and our team.
Senior team
Simon Bates
Simon has worked as a developer and technical delivery lead for digital technology agencies
including AQKA and EMC Conchango with end clients including Volkswagen and Barclays. He is a
Sun Certified Java Programmer and Sun Certified Web Component Developer.
Jim Bowes
Jim has extensive experience as a senior consultant across editorial, marketing and technology
teams most recently leading technical delivery for Cancer Research UK. He is a Scrum Alliance
Certified Scrum Professional who has delivered numerous high profile web projects for
organisations such as Barclays and the Greater London Authority.
Curtis Fox
Curtis is a technical architect and content management expert. He’s a Sun Certified Advanced
System Administrator and Sun Certified Advanced Network Administrator. He has worked
extensively as a senior consultant on numerous content management and mobile projects.
Process
Manifesto uses iterative methodologies for its projects. We believe in a continual cycle of
improvement and optimisation, in simple terms it can be articulated as:
Research
Optimise
Feedback
Analyse
Implement
We apply this philosophy across all of our work but we also use more formalised iterative
approaches for our development practices.
Scrum
This is an iterative way of working that is particularly well suited to product development. It
focuses on working software over large up front design processes and personal interactions over
heavy documentation.
Key Scrum roles
Product owner
The customer to the team, a single person that understands the product we need to create and is
empowered to make decisions about priority on the backlog. They sign off that features are as
expected and liaise with other stakeholders to provide a single voice to the team.
ScrumMaster
Like a coach to the team, often referred to as a servant-leader, the ScrumMaster facilitates Scrum
practices, protects the team and helps with the removal of impediments. They will help the team
to be self-managing, make sure they don’t over-commit and work closely with the Product
Owner to make sure the backlog is in good shape for the team.
Team
There are no function based roles on a team. The aim is for the team to be a cross-functional unit
that works together to complete the work in a given sprint, in order to meet the sprint goal. The
commitment to the product owner is from the team.
Key Scrum artefacts
Product backlog
This is a list of requirements for a product often in the format of user stories. These articulate a
requirement as:
“As a <user> I can <functional requirement> so that <business or user benefit>”
The list is kept in priority order and given a rough estimate known as story points.
Sprint backlog
Items move from the product backlog on to the sprint backlog to be delivered in a specific sprint.
At this point items are broken down in to time estimated tasks.
Key Scrum activities
Daily Standup
This is a daily meeting time-boxed to 15 minutes in which each member of the team says what
they did yesterday, what they’re planning to do today and anything that’s impeding their
progress. It’s not an update to the Product Owner or ScrumMaster (who both participate) but an
opportunity for the team to synchronise and solve problems.
Planning
This is where the team take items from the product backlog and break them down in to the
specific tasks needed to accomplish them. The meeting is often split in two with the Product
Owner present and describing stories in the first half and the team breaking them down in the
second half. Based on stories taken in to the sprint the Product Owner creates a goal for the
sprint to focus the team on what’s most important. The team commits to the items in the sprint
based on their available hours.
Review
This is the demonstration of the previous sprint’s work, in which what has been achieved is tested
against the goal. The aim is for all tasks to have been completed but the most important thing is
that the Product Owner is satisfied that the goal is met. The review is open to a wide stakeholder
group and anyone can attend/ask questions.
Retrospective
This is the opportunity for the Team, Product Owner and ScrumMaster to look back at the
previous sprint and identify things that went well, not so well and also derive actions to make
things better. There are many techniques, we frequently use Glad, Sad, Mad, which is fairly self
explanatory.
Get in touch
We’d love to hear from you. If you have any ideas for projects, need our help or just want a chat:
[email protected]
@manifestovstech
facebook.com/ManifestoDigitalLondon