First Steps in Android Development with Eclipse and Xamarin

50 %
50 %
Information about First Steps in Android Development with Eclipse and Xamarin
Technology

Published on February 25, 2014

Author: goldshtn

Source: slideshare.net

Description

Presentation from the Toronto TechHub user group on Android development. Introducing basic development concepts with Eclipse and then switching to Xamarin.Android and Visual Studio.

Sasha Goldshtein CTO, SELA Group @goldshtn blog.sashag.net First Steps in Android Development © Copyright SELA software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com

(Relevant) Android Versions Froyo Gingerbread Honeycomb •Android 2.2 •Android 2.3.x •Android 3.x Ice Cream Sandwich •Android 4.0 Jelly Bean KitKat •Android 4.1-4.3 •Android 4.4

Android Development Environment Native Android Xamarin (C#) • Eclipse/Android Studio • Android plugin for Eclipse (ADT) • Android SDK • Visual Studio • Xamarin.Android extension • Android SDK

Hello World Demo

Project Structure src gen res layout values assets Android X.X.X Libraries AndroidManifest.xml

What Makes an Android Application? • • • • Presentation layer Derive from Activity Use Views Similar to forms in the desktop world • Worker processes in application • Invisible • Responsible for updating data sources, activities, notifications • Shareable data store • Preferred way to share data across applications Activities Services Content Providers • Message-passing framework • Broadcast messages to target activity/service • Broadcast consumers • Filtered by criteria • Listen to intents that match the criteria • Enables notifications without interrupting the current activity • Device notification area Intents Broadcast Receivers Notifications

Resources Resources are non-code application parts Android resources include images, strings, simple values, animations, themes, etc. Best to keep separated/external from code External resources are easier to maintain, upgrade, and manage (…and localize!) Created under the res folder

Layout Resources Layouts specify the UI Decouple presentation layer from code Enable designing UI in XML Can be referenced as any other resource from other layouts Usually, each layout XML file = view

Code and User Interface Separation Strive to define most of the UI in XML files, and write only code in Java files Clean code/UI separation provides flexibility and easy maintenance Makes it easier to adjust for various types of hardware devices (similar to resource localization) UI elements can be manipulated from code Use findViewById to get UI element instance from code

Connecting UI to Code Demo

Localization Resources make localization easy Create a language-specific folder structure alongside the main folder structure Folder name includes qualifiers + res + values + strings.xml + values-fr + strings.xml + values-fr-rCA + strings.xml

What Is an Activity? An activity represents a screen Using Views to provide UI Extends the Activity class To navigate screens, start a new activity using an intent By default, activities occupy the entire screen Can create semi-transparent/floating activities Last-in-first-out activity stack New activity pushes foreground activity down into stack Navigating back or finishing an activity pops from the stack the previous activity

Creating Activities Extend the Activity class The base class presents an empty screen Encapsulates window display handling functionality User interfaces are created using Views Can create UI from layout or from View-derived instances //Using a layout resource identifier: setContentView(R.layout.main); //Using a View-derived instance: TextView text = new TextView(this); text.setText("New text!"); setContentView(text);

Multiple Activities All activities must be declared in the application manifest <activity android:name=".SecondaryActivity"/> Span a sub-activity using an Intent Intent launch = new Intent(this, SecondaryActivity.class); startActivity(launch);

Layouts Most commonly used layouts Layout Description FrameLayout Pins child views to the top left corner. Adding multiple children stacks each new child on top of the previous, with each new view obscuring the last. LinearLayout Adds each child view in a straight line, either vertically or horizontally. RelativeLayout Enables defining the positions of each of the child views relative to each other and the screen boundaries. TableLayout Lay out views using a grid of rows and columns. Multiple layouts can be mixed together

Selectors and Lists ListView provides a convenient UI for value selection from a long list Presents multiple items on screen Spinner provides UI for value selection Presents only a single value at a time Drop-down overlay of selectable items

Multiple Activities and ListView Demo

Xamarin: C# on 3 Billion Devices Xamarin provides a .NET runtime for iOS and Android development in C# Proprietary IDE: Xamarin Studio Full Visual Studio integration

Xamarin.Android Demo

Summary Android development environment Resources, layouts, views It’s just another {language, IDE, UI framework} The rest is just details: data, networking, preferences, styling, …

Questions Sasha Goldshtein CTO, SELA Group @goldshtn blog.sashag.net

Add a comment

Related presentations

Related pages

Hello, Android - Xamarin - Developer Center - Xamarin

Hello, Android. Introduction to ... first Xamarin.Android application using Xamarin Studio or Visual Studio and develop an understanding of the ...
Read more

Mobile App Development & App Creation Software - Xamarin

... live mobile development training; ... Xamarin Platform Create native iOS, Android, ... and measure performance with the first monitoring service built ...
Read more

Hello, Android - Xamarin - Developer Center - Xamarin

Introduction to Android Development with Xamarin. ... we build our first Xamarin.Android application ... Hello, Android Quickstart.
Read more

An Introduction to Xamarin: Part 1 - Envato Tuts+ Code ...

An Introduction to Xamarin: ... including the appropriate version of the Android SDK. Step 2: Development ... The first thing we'll do is create a new ...
Read more

Start building mobile apps for Android in C# in under 10 ...

1. Jump Right In. Welcome to Xamarin.Android! Once the installation is complete, follow these simple instructions to write and test your first ...
Read more

Baby Steps on Android with Xamarin–Part 2 - Mike Taulty ...

Baby Steps on Android with Xamarin ... in Android in the first instance but I ... one or two things inside of Eclipse for Android ...
Read more

Android for .NET Developers - CODE Online

An Android application built with Xamarin Studio executes ... IDE for Android development and you can get Eclipse when you ... the first step, ...
Read more

(Newbie) Switch between Pages on Click - Xamarin Forums

... , I make my first steps with App ... live mobile development training; ... Windows Phone and with Eclipse for Android. Now Xamarin has a turn ...
Read more