ando-it-yourself droid praveen kumar pendyala. outline brief intro to the droid developement setting...

31
Ando-it- yourselfdroid Praveen Kumar Pendyala

Upload: halie-hardgrove

Post on 29-Mar-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

An‘do-it-yourself’droid

Praveen Kumar Pendyala

Page 2: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Outline• Brief intro to the Droiddevelopement

• Setting up the Life saviors - Development tools

• ‘Hello Droid’ application

• Application structure

• Intelligence and beauty – Java code and UI (XMLs)

• Our best pals – APIs, In-built libraries

• Group chat app UI and Java code OnclickListeners Intents Multithreading Network actions Changing views from Java code Permissions

• Exporting and signing your application

• Web app code

Page 3: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Intro• Why Android ?

Page 4: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Intro• Android versions and

StatsVersion Codename API Distribution

1.6 Donut 4 0.2%

2.1 Eclair 7 2.4%

2.2 Froyo 8 9.0%

2.3 - 2.3.2

Gingerbread

9 0.2%

2.3.3 - 2.3.7 10 47.4%

3.1Honeycomb

12 0.4%

3.2 13 1.1%

4.0.3 - 4.0.4Ice Cream Sandwich 15 29.1%

4.1Jelly Bean

16 9.0%

4.2 17 1.2%

5.0 ? Key lime pie ? -

Page 5: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Development tools - Intro• Eclipse

Requires Java Runtime Environment (JRE) Like an advanced notepad/Gedit you used for C/C++ A general development tool for Java programming (not limited to

android)

• Android SDK Contains the necessary tools to create, compile and package

Android application

• ADT (Android Development Tools) A set of components (plug-ins) which extend the Eclipse IDE with

Android development capabilities

Page 6: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Development tools - setup• JRE

• Run and install the JRE software that came with your bundle

• What about Eclipse, ADT, Android SDK ?• Lucky you are…• Google now bundled everything and gives you as a package which

can be used directly after JRE installation ! (You may not appreciate this, as you haven’t been through earlier setup process)

Page 7: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

‘Hello Droid’ applicationIn eclipse,1. File New Android Application Project (or) File New other Android Android

Application Project

Page 8: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

‘Hello Droid’ application

Enter these valuesApplication Name : HelloDroidProject Name : HelloDroidPackage Name : com.myfirstapp.hellodroid

Website of your application in reverse

Press Next twice………………..

Page 9: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

‘Hello Droid’ application

Play with the Names, Images and Shapes. I suggest, you select your fav pic, for feel

Press Next twice again…..(Yeah you have to select BlankActivity)

Page 10: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

‘Hello Droid’ application

Leave the values as they are for this session

Finish……

Simple…..Isn’t it ??

Page 11: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Application structure

All Java code

All images used

The UI design elements

All the words you see in the app and colors that appear

Your application details-Name, What should come 1st, Version, Services used-Permissions that are needed, Activities(IMPORTANT !!)

Page 12: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Manifest.xml

This is what gives an Idea of what your application is, what it uses and ….What not ? Almost every info

Page 13: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Strings and colors

Page 14: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

UI design

Page 15: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Java code, Libraries, APIs

API – Application Program Interface

Page 16: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application - UI

<app> res layout activity_main.xml

Page 17: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application - Strings<app> res values strings.xml

Page 18: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – OnclickListeners & Intents

<app> src MainActivity.java

Now lets setup an action for our button. Going to a new screen on click

Page 19: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Creating new XMLs and classes

Lets now create an Activity and corresponding Layout XML for messaging

1. Goto <app> res layout• Right click on layout New Android XML file Name it ‘messaging.xml’ and

finish

2. Goto <app> src com.<packagename>• Right click on package New Class Name it ‘Messaging’ and finish

Page 20: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – More on UI

<app> res layout messaging.xml

Add these two as childs to the main LinearLayout

Page 21: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Starting threads

<app> src <package> Messaging.java

Lets receive the Nick and do some settings

Page 22: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Multithreading<app> src <package> Messaging.java

• Network activity always on a background thread

• No UI changes in this thread !! (IMP)

Page 23: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Network data reception

<app> src <package> Messaging.java

Page 24: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

<app> src <package> Messaging.javaGroupchat application – Network data sending

Page 25: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Changing views from Java code

<app> src <package> Messaging.java

Page 26: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Extras (Special characters support)

<app> src <package> Messaging.java

Page 27: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Activities, Permissions<app> src <package> Messaging.java

• Is that it ? Will it work ? Of course not….

Add Internet permission

Declare your class as an activity

Page 28: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Ready to go….<app> src <package> Messaging.java

Just seconds away to see it live….

• In package explorer Click on your project Click Run Android application Select your device (or) Start emulator

• Problem ?? Device not detected ??• Just explore to the ‘bin’ folder in your application.• Copy and transfer <app>.apk file to your device

Page 29: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Export and signing your application

• By default when you press run apps are signed using debug key• Debug key signed apps not allowed in the market

• To Export your application for publishing in Android market• File Export Android (Export And…) Create a Keystroke

Create an alias Save the apk Finish

Page 30: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

Groupchat application – Web endputData.php

Page 31: Ando-it-yourself droid Praveen Kumar Pendyala. Outline Brief intro to the Droid developement Setting up the Life saviors - Development tools Hello Droid

This is just the beginning ...

I look forward to see awesome apps from you all…Please do keep me posted if you make an app in future

Hope you all enjoyed

Thank you