Training Session 2

Post on 19-May-2015

939 views 4 download

description

Day 1. ->Program Introduction ->Installation guide ->Creating New Application ->Project Structure ->Basic Application development using Button, Edittext, textView and Toast

Transcript of Training Session 2

HELLO FELLOW ENTHUSIASTS

Vivek Bhusal Mobile Application Developer, YoungInnovations

2 years in mobile application development

http://vivekbhusal.com

Toastmasters Timer

StoresMunk iPaidaBribe Marriage Center

Collection

@vivekbhusal

Rakeeb Rajbhandari Jr. Mobile Application Developer, YoungInnovations

6 months in mobile application development

Taxi Fare Self Help

Anjan Shrestha UX Lead, YoungInnovations

http://anjhero.me

5+ years in UI design and development

Prawesh Shrestha Project Manager, YoungInnovations

3+ years Manager for Mobile Nepal

Mobile Nepal Community Common Platform to share, learn and grow

Events Hello Sarkar M2Work Hackathon Pivot Nepal NASA Space Apps

http://mobilenepal.net

This is an extensive course that covers the Android Basics and more.

This is an extensive course that covers the Android Basics and more. Aimed to get you STARTED on the right foot.

This is an extensive course that covers the Android Basics and more. Aimed to get you STARTED on the right foot. Know your Android better.

This is an extensive course that covers the Android Basics and more. Aimed to get you STARTED on the right foot. Know your Android better. Develop an Android Application?

INSTALLATION

The official development environment Google recommends for Android

Java SDK Android SDK Android Eclipse IDE

The official development environment Google recommends for Android

Java SDK Android SDK Android Eclipse IDE

Installed Together is the

ADT Bundle

Installed Together is the

ADT Bundle

PREREQUISITES Java SDK and the Java Runtime Environment

http://bit.ly/bMkbpo

Download ADT Bundle from http://developer.android.com/sdk/index.html

Unzip and Extract

Navigate to the “eclipse” folder to launch eclipse

Development demands packages which can be downloaded from SDK Manager

Select these boxes.

Also, select -  Doc, Samples,

Intel -  Optional

-  Android Support Library

-  Google USB Driver

Select Install Packages

TESTING ON

EMULATORS

We can test apps that we are building on Android Emulator Testing can also be done plugging an Android device For a smoother experience, installation of the Intel x86 HAXM is recommended. http://bit.ly/1aFloCd

http://developer.android.com/tools/devices/emulator.html

Setting up Emulator

AVD Manager

In Eclipse, select window -> Android Virtual Device Manager Select New … on the right menu. Enter values as shown.

Running the Emulator

AVD Manager

TIME TO

PROGRAM

SETTING UP THE PROJECT

SETTING UP THE PROJECT

SETTING UP THE PROJECT

Checklist

Minimum SDK support must be setup Features like the ActionBar is not available in

earlier API versions. Target APK

The API being targetted Always compile with the latest API

Keep clicking on Next untill we end the setup process

Getting started

Create the UI for our application.

1

2 Make the UI functional

xml  

java  

xml   java  

UI Instatiation

UI Functions

Guidelines

While working with Views/UI elements always give them an id

<Button android:id = “@+id/button” android:layout_width = “fill_parent” android:layout_height = “wrap_content” android:text = “Press Me”/>

width and height are compulsory to declare. id's are to be declared if they are to be manipulated.

Refer to your layout in your src with this

setContentView() : … setContentView(R.layout.file_name);

Refer to the Button declared earlier

Button button: … (inside onCreate()) button = (Button) findViewById(R.id.button);

Manipulating the Button

button.setOnClickListener( … );

Displaying the Short Popup

Toast.makeText(getApplicationContext(), “This is a short popup message”, Toast.LENGTH_SHORT).show();

R class found under gen

Auto-generated: DO NOT EDIT

Contains ID of the project resources

Use findViewById and Resources object to get access to the resources:

E.g. Button = (Button)findViewById(R.id.button); E.g. getResources().getString(R.string.hello);

THAT’S ALL FOLKS! WE’LL SEE YOU TOMORROW