• Save
Android Code Camp 2012 - eng
Upcoming SlideShare
Loading in...5
×
 

Android Code Camp 2012 - eng

on

  • 2,032 views

The slides we saw at the Android Code Camp 2012. The course was held in Urbino, at the headquarters of the degree course "Informatica Applicata" (Computer Science), University of Urbino "Carlo Bo".

The slides we saw at the Android Code Camp 2012. The course was held in Urbino, at the headquarters of the degree course "Informatica Applicata" (Computer Science), University of Urbino "Carlo Bo".

Statistics

Views

Total Views
2,032
Views on SlideShare
2,032
Embed Views
0

Actions

Likes
3
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Dati: http://www.idc.com/getdoc.jsp?containerId=prUS23638712

Android Code Camp 2012 - eng Android Code Camp 2012 - eng Presentation Transcript

  • Android Code Camp, Urbino — 2012.Benvenuti.AndroidCode Camp
  • Android Code Camp, Urbino — 2012.Theory overview.The smartphone market.The Android project.Android architecture.The ecosystem.Application overview.Structure of an Android project.Hands-on: setting up the development environment.„Hello World.―
  • Android Code Camp, Urbino — 2012.Mobile market.The smartphone market.Numbers and growth.The Android market.Activations.Application marketplace.Fragmentation.
  • Android Code Camp, Urbino — 2012.The smartphone market.433 milions of units in 2011.616 milions of units forecast for 2012.• Market growth (contractino of feature phone sales).• Product obsolescence.Tablets: 320 milions of units in 2015.
  • Android Code Camp, Urbino — 2012. The smartphone market. 2011 2.5 3.9 18.3 50.812.5 20.4 Android iOS BlackBerry Symbian Windows Phone Others
  • Android Code Camp, Urbino — 2012.The smartphone market. 2012 5.4 3.6 6.8 7.426 104.8 Android iOS BlackBerry Symbian Windows Phone Others
  • Android Code Camp, Urbino — 2012.The Android market.Astounding growth (+106% forecast).Mainly Samsung devices: Up to 33% of all devices.2012:500 milions of devices activated.1.3 milions of peak activations per day.
  • Android Code Camp, Urbino — 2012.
  • Android Code Camp, Urbino — 2012.Application market.Android < iOS: More than 400.000 applications, against 500.000 apps for iOS.• Google Play• Amazon AppStore for Android• Other stores: GetJar, AppBrain, etc.
  • Android Code Camp, Urbino — 2012.Application market.Android < iOS: Only ¼ of revenue, on average. Different market segment / users. Almost 70% of applications are free or follow the freemium model (against 50% on iOS). The fragmentation issue.
  • Android Code Camp, Urbino — 2012.Fragmentation.
  • Android Code Camp, Urbino — 2012.Fragmentation.
  • Android Code Camp, Urbino — 2012.Android.Google‘s mobile OS.History.Versions and evolution.The open-source project.
  • Android Code Camp, Urbino — 2012.A short history of Android.2003: Andy Rubin founds ―Android Inc‖. “...smarter mobile devices that are more aware of its owners location and preferences.”2004: Apple starts ―Project Purple‖, a secret project with AT&T.2005: Google buys out Android Inc and continues the devlopment of the OS.
  • Android Code Camp, Urbino — 2012.A short history of Android.2007, jan: Apple releases the first iPhone.2007, nov: Google, HTC, Samsung reveal the Open Handset Alliance & Android.2008: first Android phone: HTC Dream (G1).
  • Android Code Camp, Urbino — 2012.Android versions. Year Version Codename 2008 1.0 n/a 2009 1.1 Petit Four 1.5 Cupcake 1.6 Donut 2.0 Eclair 2010 2.2 Froyo (Frozen Yogurt) 2.3 Gingerbread 2011 3.0 Honeycomb 4.0 Ice Cream Sandwich 2012 4.1 Jelly Bean ? 4.2 K…?
  • Android Code Camp, Urbino — 2012. Android versions. 1.5 Soft keyboard, clipboard, video…1.6Resolution independence 2.0 Maps, Navigation
  • Android Code Camp, Urbino — 2012.Android versions. 3.0 Digital style, tablet optimization 4.0 Halo theme, Project Butter Google Now, Roboto
  • Android Code Camp, Urbino — 2012.Android: openness.October 2010, Steve Jobs: „Google likes to characterize Android as open and iOS as closed. We think this is disingenuous. […] The real difference is integrated versus fragmented.”
  • Android Code Camp, Urbino — 2012.Android: openness.
  • Android Code Camp, Urbino — 2012.Android: open-source project.The code of Android is available under„free― and „open-source― licenses.Linux kernel (Open Handset Alliance): GNU GPL v2, public development.Android system (Google): Network, telephony, Google apps. Apache License v2.0, private.
  • Android Code Camp, Urbino — 2012.Android: open-source project.Production of a „flagship phone― by Google(Nexus), is followed by release of code(and OEM phones).Google Play is available on certification.„Honeycomb incident― (2011).License is incompatible with GPL (FSF).
  • Android Code Camp, Urbino — 2012.The architecture.Operating System architectureLinux Kernel.Native libraries.Android Runtime. Dalvik Virtual Machine. Core Libraries.Application framework.Application layer.
  • Android Code Camp, Urbino — 2012.The architecture.
  • Android Code Camp, Urbino — 2012.Linux Kernel.Kernel 2.6+.Used for process and threadmanagement, low-level memorymanagement, the networkstack, security, for the driver model.
  • Android Code Camp, Urbino — 2012. Native libraries. C/C++ libraries executed on top of the Linux kernel and used in many fields of the Android system.They expose a lot of funcionalities todevelopers through the applicationframework.
  • Android Code Camp, Urbino — 2012.Android Runtime.It makes an Android device much differentfrom a mobile Linux implementation.Combining the Dalvik Virtual Machine andthe Core Libraries makes possible theexecution of Android applications.
  • Android Code Camp, Urbino — 2012.Virtual machine.Software implementation of a machine(with a defined Instruction Set Architecture)that executes programs like a physicalmachine.Virtualization: simulation of an environmentwhere Guest ISA and Host ISA match.Emulation: simulation of an environmentwhere Guest ISA and Host ISA aredifferent.
  • Android Code Camp, Urbino — 2012.Java virtual machine.Virtual machine that executes programswritten in byte-code: intermediaterappresentation between machinelanguage and Java source code.JVM is an Oracle (ex Sun) specification.Main implementations:HotSpot – OpenJDK (GPL).HotSpot – OracleJDK.
  • Android Code Camp, Urbino — 2012.Dalvik virtual machine.Virtual machine that executes .dex (DalvikExecutable) files.Java source code compiled in .class filesand converted to .dex format.Each Android application runs in aseparate process within its Dalvik virtualmachine instance.JIT compiler (since version 2.2).
  • Android Code Camp, Urbino — 2012.Dalvik vs. JVM.Dalvik < JVM.But it is a multidimensional problem.• Register-based.• Efficient with multiple VMs.• Minimum memory footprint.• Small startup time.
  • Android Code Camp, Urbino — 2012.Core libraries.Dalvik does not comply with either theJ2SE specifications, nor the J2ME.Core libraries provide most of thefunctionalities available through the Javalibraries, as well as Android specificlibraries.
  • Android Code Camp, Urbino — 2012.Application framework.Provides key services, encapsulated inJava objects, to the applications of theabove level.These services are available for bothsystem applications and for third partyapplications.
  • Android Code Camp, Urbino — 2012.Application layer.User level applications written in Javalanguage. System app = Third party App
  • Android Code Camp, Urbino — 2012.The ecosystem.Development ecosystem.Android SDK.Eclipse IDE.Application Programming Interfaces.
  • Android Code Camp, Urbino — 2012.SDK: emulator.Software that emulates the function andappearance of a virtual hardwareconfiguration (AVD: Android VirtualDevice).
  • Android Code Camp, Urbino — 2012.SDK: emulator.User-friendly interface to configure AVDs.
  • Android Code Camp, Urbino — 2012.SDK: tools.Logcat: collects logs of an Android device.Lint: static analisys to optimize and detectcommon mistakes.Proguard: reduce binary size, optimizeand obscure given code. It makesapplications faster and more resilient toreverse engineering.
  • Android Code Camp, Urbino — 2012.SDK: Dalvik Debug Monitor ServeDebugging tool for Android devices:gathers information aboutprocesses, threads, heap, logcat andsupports event emulation.
  • Android Code Camp, Urbino — 2012.SDK: Android Developer Tools.Plugin for the Eclipse IDE.It simplifies the creation, compilation andmaintenance of projects.It integrates development tools.It includes graphical editors anddocumentation.
  • Android Code Camp, Urbino — 2012.Eclipse.Open-source developmentenvironment,multi-platform andmulti-language.It is the referenceplatform for Android.Alternatives:ANT, NetBeans…
  • Android Code Camp, Urbino — 2012.Android APIs.
  • Android Code Camp, Urbino — 2012.Android 1.5, API 3.Playback and audio/video capture.Speech recognition.Widgets.Notifications.WebView.
  • Android Code Camp, Urbino — 2012.Android 1.6, API 4.Gestures.Speech synthetizer.CDMA support.Variable size and density screens support.
  • Android Code Camp, Urbino — 2012.Android 2.1, API 7.Bluetooth 2.1 support.Live Wallpapers.
  • Android Code Camp, Urbino — 2012.Android 2.2, API 8.JIT compiler.SD card installation support.Speech recognition improvement and thirdparty openness.Flash technology support.
  • Android Code Camp, Urbino — 2012.Android 2.3, API 9/10.Native Voip support (SIP).NFC support.Concurrent Garbage Collector.Improved media format support.
  • Android Code Camp, Urbino — 2012.Android 3.0, API 11.Fragments.ActionBar.New drag ‗n drop APIs.2D hardware acceleration support.New 3D framework renderscript.Improved media format support.
  • Android Code Camp, Urbino — 2012.Android 3.1, API 12.USB peripherals support.Resizable Widgets.Improved media format support.
  • Android Code Camp, Urbino — 2012.Android 4.0.1, API 14.Smartphone and Tablet merge.Linux kernel 3.x.Redesigned UI to enhance coherence andunification.More powerful notifications.Continuous speech recognition support.Social APIs.Low level streaming APIs.
  • Android Code Camp, Urbino — 2012.Android 4.1.3, API 16.Project Butter.Expandable notifications.Improved social APIs.Advanced speech recognition.Enhanced speech synthetizer.Google Now.Flash technology pulled out.
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Activity.Each activity represents one fullscreenwindow.
  • Android Code Camp, Urbino — 2012.Activity.Each activity should be used as an atomicaction of the user.
  • Android Code Camp, Urbino — 2012.Activity.Some activities could have a returningvalue.
  • Android Code Camp, Urbino — 2012.Activity.Activities are probably the mostfundamental parts of an app!We are going to return on it…
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Service.A task the app or the system does withoutdirectly affecting the UI (a backgroundtask).Examples: Gathering data from the system. Updating data of an app. Download new RSS feeds from a server.
  • Android Code Camp, Urbino — 2012.Service.It cannot directly communicate with theuser. Though it can exchange data withactivities (which may belong to the sameapp or not) and the system.
  • Android Code Camp, Urbino — 2012.Service.If a particular service should never bekilled by the system, it should be declaredas a foreground service.
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Content provider.• It‘s an abstraction of a set of structured data.• Implements the CRUD interface (create, retrieve, update, and delete).• Can be also used to share data among different applications.Android provides many ready-madeproviders. It is also possible to implementcustom providers.
  • Android Code Camp, Urbino — 2012.Content provider.Some examples:• List of contacts.• List of images on the device.• Data from a DB SQLite.• Data from a web service.
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Broadcast receiver.Components which are employed forintra-application / inter-processcommunication.They receive so-called broadcast intents…
  • Android Code Camp, Urbino — 2012.Intent.Are the messaging system betweenvarious components of the system.Each intent represents a structure whichencapsulates data of a message.An intent can be thought as an abstractionof: An operation to execute. An event which has just happened.
  • Android Code Camp, Urbino — 2012.Intent.Possible values:Field ValueComponent name it.uniurb.codecamp.testAction ACTION_CALLData URI tel:07224475 Type integerCategory CATEGORY_LAUNCHERExtras "tel_number":intFlags FLAG_ACTIVITY_SINGLE_TOP
  • Android Code Camp, Urbino — 2012.Intent.Send an image:Field ValueAction SENDData content://media/external/pic16Show a spot by Google Maps:Field ValueAction VIEWData geo:latitude,longitude?z=zoom
  • Android Code Camp, Urbino — 2012.Intent.The sender is always known,the receiver may be unknown.
  • Android Code Camp, Urbino — 2012.Implicit intent.Android looks for the best receiver atruntime. If it finds: One, the receiver is activated. More than one, the user can choose. None, the intent fails.
  • Android Code Camp, Urbino — 2012.Implicit intent resolution.Android decides:According to the type of component: Activity, Service, Broadcast Receiver.According to the field ACTION.According to the field CATEGORY.According to the field DATA (URI e Type).
  • Android Code Camp, Urbino — 2012.Broadcast receiver (reprise).Intra-application / inter-processcommunication.They receive broadcast intents.May be associated with other components.Have no GUI.May make use of notifications.May start other components.
  • Android Code Camp, Urbino — 2012.Broadcast receiver (examples).Receiving battery status changes.Being notified of a downloaded file.Receiving the device boot completedevent.
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Widget.Incorporated in other applications (insidean ―App Widget Host‖).Long update interval.(At least: 30 min.)Receives inputs from the user and updatesfrom a Broadcast Receiver (which must beimplemented to act as an app widget).
  • Android Code Camp, Urbino — 2012.Widget examples.
  • Android Code Camp, Urbino — 2012.Widget examples.
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Fragment.Modular part of an activity.Has its own lifecycle.Can be added or removed even while theactivity is in resumed state.Introduced to address the need of puttingan Activity into another.
  • Android Code Camp, Urbino — 2012.Fragments and layout changes. Portrait Landscape
  • Android Code Camp, Urbino — 2012.Applications overview.Components of an application.Activity.Service.Content provider.Broadcast receiver.Intent.Widget.Fragment.Notification.
  • Android Code Camp, Urbino — 2012.Notification.Used to notify the user when an eventhappened or has been triggered: In the overall system. In the activity the user is interacting with. In a GUI-less component. (For instance, a service.)
  • Android Code Camp, Urbino — 2012.Toast notification.Suitable for background events.No user input allowed.Barely more visible than Logcat…
  • Android Code Camp, Urbino — 2012.Dialog notification.Suitable for events relating to the currentactivity: loading, confirmation, etc.Allows (or requires) user input.
  • Android Code Camp, Urbino — 2012.Status notification.Suitable for background events.Requires the user input.Persistent.Typically the user has to click on it (or clearit) to let it disappear from the notificationsbar. When clicked, usually an activity is launched.
  • Android Code Camp, Urbino — 2012.Further details…More on applications.Layout.Back stack.Activity lifecycle.Service lifecycle.Fragment lifecycle.
  • Android Code Camp, Urbino — 2012. Layout. Typically composed by View and ViewGroup (and Fragment).TableLayout EditText TextView Button
  • Android Code Camp, Urbino — 2012.Layout.Generally defined starting from an xml file. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/rss_title" android:layout_width="wrap_content" android:layout_height="wrap_content" … /> <ListView android:id="@+id/rss_list" android:layout_width="match_parent" android:layout_height="wrap_content" …> </ListView> <Button android:id="@+id/load" android:layout_width="wrap_content" … /> </RelativeLayout>
  • Android Code Camp, Urbino — 2012.Further details…More on applications.Layout.Back stack.Activity lifecycle.Service lifecycle.Fragment lifecycle.
  • Android Code Camp, Urbino — 2012.Back stack.Each activity belongs to a task.Each task contains a collection of activitiesordered by their launch event (back stack).
  • Android Code Camp, Urbino — 2012.Back stack.Android handles multiple tasks at the sametime. Only one task can be in foregroundstate ata time.A new task starts every time an activity hasbeen lanched from the home screen : <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />Some launch modes can affect this.
  • Android Code Camp, Urbino — 2012.Back stack.A task structure can be changed by:• Starting a new activity (increase).• Using the Back Button (decrease).The task status changes when:• There is an interruption for an external event.• The Home Button is pressed.• An activity is started from recent menu.
  • Android Code Camp, Urbino — 2012.Launch modes.Generally…• When an activity starts for the first time it is added on top of the current task (or on top of a new one if MAIN/LAUNCHER).• Even if the activity was already started, another instance will be created.
  • Android Code Camp, Urbino — 2012. Launch modes. Launch modes allow to define how a new instance of an activity is associated with the current task. Launch modes can be defined via manifest or using intent flags.Launch Mode Behaviour Default Creates new activity. Different instances can belong to the same task. Each task may contain different instances of same activity. SingleTop Same as Default, but a new instance is started only if the activity is not at the top of the back stack. SingleTask If an old instance of the same activity is present in the system then it will be reactivated, otherwise a new instance is created. There always be one instance of the same activity in the system.SingleInstance Same as SingleTask but the activity is always the unique inhabitant of its task.
  • Android Code Camp, Urbino — 2012.Launch modes.DEMO…
  • Android Code Camp, Urbino — 2012.Further details…More on applications.Layout.Back stack.Activity lifecycle.Service lifecycle.Fragment lifecycle.
  • Android Code Camp, Urbino — 2012.Activity lifecycle.
  • Android Code Camp, Urbino — 2012.Activity lifecycle.
  • Android Code Camp, Urbino — 2012.Activity lifecycle.
  • Android Code Camp, Urbino — 2012.Activity lifecycle.
  • Android Code Camp, Urbino — 2012.Activity lifecycle.
  • Android Code Camp, Urbino — 2012.Activity lifecycle.DEMO…
  • Android Code Camp, Urbino — 2012.Activity lifecycle.Saving the activity state.
  • Android Code Camp, Urbino — 2012. Activity lifecycle. Even if the system needs to destroy an activity in order to get its resources back, the state should be preserved in order to maintain the user experience consistent.onSaveInstanceState(Bundle)onRestoreInstanceState(Bundle)onCreate(Bundle)
  • Android Code Camp, Urbino — 2012.More on Activity lifecyle.When will these methods be called? onRestoreInstanceState() just after onStart(), onSaveInstanceState() before onStop() and maybe before onPause().There are no guarantees it will be actuallycalled (back button)!
  • Android Code Camp, Urbino — 2012.More on Activity lifecyle.What should we save in the Bundle? The transient state of the activity. The state of the UI (each view saves its own status).What shouldn‘t we save in the Bundle? Data non related to that specific instance of the activity. Persistent data should be saved in the onPause() method.
  • Android Code Camp, Urbino — 2012.Further details…More on applications.Layout.Back stack.Activity lifecycle.Service lifecycle.Fragment lifecycle.
  • Android Code Camp, Urbino — 2012.Started & bound services.Started: Started by another component executing the startService() method. Killed by itself or by another component.
  • Android Code Camp, Urbino — 2012.Started & bound services.Bound: Started by 1+ components executing bindService(). It lasts until the last bound client has called unbindService().
  • Android Code Camp, Urbino — 2012.Service lifecycle.
  • Android Code Camp, Urbino — 2012.Further details…More on applications.Layout.Back stack.Activity lifecycle.Service lifecycle.Fragment lifecycle.
  • Android Code Camp, Urbino — 2012.Fragment lifecycle.
  • Android Code Camp, Urbino — 2012.An Android project.Eclipse Android project structure.Directories.Resources management.Application manifest.
  • Android Code Camp, Urbino — 2012.Android folders./src: Java sources (or .aidl or…)/bin: compiled (.apk, ecc…)/libs: external libraries/gen: generated sources (R.java)/assets: unmanaged resources/res: managed resources/AndroidManifest.xml: metadata.properties, .cfg, .xml: others…
  • Android Code Camp, Urbino — 2012.An Android project.Eclipse Android project structure.Directories.Resources management.Application manifest.
  • Android Code Camp, Urbino — 2012.Android Asset Packaging Tool.Each resource inside /res directory has aninteger ID.The class R.java is generated: With a public static final class for each type of resources. An integer field named as the resource it represents.The R.java is added inside the applicationnamespace.
  • Android Code Camp, Urbino — 2012.Resource resolution.Each resource can has one or more differentversions. Each version is a different folder with aproper name.• layout-long• anim-v14• drawable-en-rUS-land-night-notouch English language, in America, in landscape mode, is night and is not a touch device.Proper resource is picked at runtime by the framework.
  • Android Code Camp, Urbino — 2012.Making resources.Declaration via XML: <Button android:id=" @+id/nice_button " /> <string name=―hello_world‖> hello world</string>Each file should be created in a specific/res subdirectory.
  • Android Code Camp, Urbino — 2012.Accessing resources.Via XML: @[<package_name>:]<resource_type>/<resource_name> <Button android:text=" @string/hello_world " />Via source code: [<package_name>.]R.<resource_type>.<resource_name> ImageView imageView = (ImageView) findViewById(R.id.myimageview); imageView.setImageResource(R.drawable.myimage);
  • Android Code Camp, Urbino — 2012.An Android project.Eclipse Android project structure.Directories.Resources management.Application manifest.
  • Android Code Camp, Urbino — 2012.Application manifest.AndroidManifest.xml in root directory.Describes the application, its name, itspackage, its namespace, its permissions and soforth.Declares the minimum and the targeted APIlevel.It also describes any components in theapplication: activities, services, receivers, etc.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Preparing the environment.Installing the Eclipse IDE.Adding the Android toolchain (ADT): https://dl-ssl.google.com/android/eclipse/Let it download the Android SDK.…we can start!
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Creating a new project.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Android log.Class android.util.Log.Different levels of logging: ASSERT: Log.wtf() ERROR: Log.e() WARN: Log.w() INFO: Log.i() DEBUG: Log.d() VERBOSE: Log.v()
  • Android Code Camp, Urbino — 2012.Android log.Each log entry has several parameters: TAG: discriminator (internal to app). Messaggio: content. Eccezione: optional.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Layouts.Simple and structured way of developingthe graphical interface of an application.Flexible and dynamic.For instance: LinearLayout, RelativeLayout, FrameLayout.
  • Android Code Camp, Urbino — 2012.LinearLayout.<LinearLayout android:layout_width=„match_parent“ android:layout_height=„match_parent“ android:orientation=„horizontal“ > <Item1 /> <Item2 /> <Item3 /></LinearLayout>
  • Android Code Camp, Urbino — 2012.RelativeLayout.<RelativeLayout> <Item1 /> <Item2 layout_below=„Item1“ layout_alignParentLeft=„true“ /> <Item3 layout_below=„Item1“ layout_alignParentRight=„true“ /></RelativeLayout>
  • Android Code Camp, Urbino — 2012.Buttons & callbacks.<Button android:id=„@+id/buttonToast“ />Button button = (Button) this.findViewById(R.id.buttonToast);button.setOnClickListener( new OnClickListener(){ @Override public void onClick(View arg0) { }});
  • Android Code Camp, Urbino — 2012.Toast notifications.Created via static method:Toast.makeText(Context, “Text”, Toast.LENGTH_SHORT).show();Text is shown in an overlay dialog for apredefined duration.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Implicit intent.Intent i = new Intent( Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));Context.startActivity(i);The default action ACTION_VIEW is definedby the system.It will be handled by the system browser(by default, since it targets an HTTPresource).
  • Android Code Camp, Urbino — 2012.Explicit intent.Intent i = new Intent( Context, Class);Context.startActivity(i);Intent targeting an explicit class (anactivity, in this case).Will not be handled nor resolved at runtimeby the system.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Lists.Lists of data are displayed by a ListView.Data is handled by a ListAdapter: It handles access to the data. Determines how it is shown.Built in ArrayAdapter works on genericobjects.
  • Android Code Camp, Urbino — 2012.Custom list adapters.In order to customize lists: Adapt data shown for each entry, Adapt layout, Adapt colors, formats, headers, etc.You need to implement a custom ListAdapter, that overrides the getView() method.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Components of a notification.Icon (top bar and notification panel).Ticker text (message in top bar).Overlay number.Flags (AUTO_CANCEL, INSISTENT, etc).Content view (panel), can be generated (see LatestEvent).PendingIntent determining action.Unique Identifier.
  • Android Code Camp, Urbino — 2012.Updating notifications.The panel shows one single notification foreach unique notification identifier.Ensures there is a single notification foreach kind of notification provided by anapplication (logical separation).PendingIntent instances can be updatedby the application (updates the action, notthe notification), and viceversa.
  • Android Code Camp, Urbino — 2012.Tutorial.Fancy ways to say „hello world―.Preparing the work environment.Creating a new project.„Hello World― via Logcat.Layouts, callbacks and toast notifications.Intents and navigation.Lists.Status notifications.Implementing a background service.
  • Android Code Camp, Urbino — 2012.Background service.An Intent is used to explicitly specify aservice to start and to stop.Intent serviceIntent = new Intent( Context, Service.class);Context.startService(serviceIntent);