Android - Pune GTUG

Preview:

Citation preview

Programming on Android

By Rohit GhatolFrom

Pune Google Technology User Grouphttp://pune-gtug.blogspot.com

http://blog.punegtug.org

What is Pune-GTUG?

GTUG stands for Google Technology User Group

http://blog.punegtug.org

Programming on Android

http://blog.punegtug.org

Topics

• What is Android?• Android Architecture• Building blocks• Programming Basics• Sample Application• Questions and Answers

http://blog.punegtug.org

What is Android?

Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.

http://blog.punegtug.org

What is Android?

Features• Application framework enabling reuse and replacement of components• Dalvik virtual machine optimized for mobile devices• Integrated browser based on the open source WenKit engine• Optimized graphics powered by a custom 2D graphics library; 3D graphics based on

the OpenGL ES 1.0 specification (hardware acceleration optional)• SQLite for structured data storage• Media support for common audio, video, and still image formats (MPEG4, H.264,

MP3, AAC, AMR, JPG, PNG, GIF)• GSM Telephony (hardware dependent)• Bluetooth, EDGE, 3G, and WiFi (hardware dependent)• Camera, GPS, compass, and accelerometer (hardware dependent)• Rich development environment including a device emulator, tools for debugging,

memory and performance profiling, and a plugin for the Eclipse IDE

http://blog.punegtug.org

Topics

• What is Android?• Android Architecture• Building blocks• Programming Basics• Sample Application• Questions and Answers

http://blog.punegtug.org

Android Architecture

http://blog.punegtug.org

Topics

• What is Android?• Android Architecture• Building blocks• Programming Basics• Sample Application• Questions and Answers

http://blog.punegtug.org

Building Blocks

http://blog.punegtug.org

Activity

Media Player Screen

Service

Background Service

Content ProviderBroadcast Receivers

MP3 DownloadedMusic Directory

Intent

Building Blocks – The Glue

http://blog.punegtug.org

What do I want to do?

Intent helps in • Launching Activities and Services• Application taking action on an event• Reusing building blocks (not code)

What if I want to send my mp3 file to my friend?• Do I write the email logic in my app?• How do I reuse existing email app?

• Explicit Intents• Implicit Intents

Topics

• What is Android?• Android Architecture• Building blocks• Programming Basics• Sample Application• Questions and Answers

http://blog.punegtug.org

Programming Basics

• Android SDK provides followingo An Emulatoro Command line tools to control emulatoro Eclipse Plugin (downloaded separately)o Direct Testing of application on Mobile Devices

http://blog.punegtug.org

Programming basics

http://blog.punegtug.org

Programming basics

http://blog.punegtug.org

Programming basics

http://blog.punegtug.org

Main Screen(Activity)

Main Config File

Layout File

Generated from res directory

Programming basics

HelloWorld.javapackage com.punegtug.helloworld;import android.app.Activity;import android.os.Bundle;public class HelloWorld extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); }}

http://blog.punegtug.org

Programming basics

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:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello"/></LinearLayout>

http://blog.punegtug.org

Programming basics

http://blog.punegtug.org

Programming basics

http://blog.punegtug.org

Topics

• What is Android?• Android Architecture• Building blocks• Programming Basics• Sample Applications• Questions and Answers

http://blog.punegtug.org

Digg

http://blog.punegtug.org

Digg in Action

http://blog.punegtug.org

Digg in Action

http://blog.punegtug.org

Del.icio.us

http://blog.punegtug.org

Del.icio.us in action

http://blog.punegtug.org

Del.icio.us in action

http://blog.punegtug.org

Del.icio.us in action

http://blog.punegtug.org

Del.icio.us in action

http://blog.punegtug.org

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

GodSpeed Application In Action

Questions?

?

http://blog.punegtug.org