38
HELLO FELLOW ENTHUSIASTS

Training Session 2

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Training Session 2

HELLO FELLOW ENTHUSIASTS

Page 2: Training Session 2

Vivek Bhusal Mobile Application Developer, YoungInnovations

2 years in mobile application development

http://vivekbhusal.com

Toastmasters Timer

StoresMunk iPaidaBribe Marriage Center

Collection

@vivekbhusal

Page 3: Training Session 2

Rakeeb Rajbhandari Jr. Mobile Application Developer, YoungInnovations

6 months in mobile application development

Taxi Fare Self Help

Page 4: Training Session 2

Anjan Shrestha UX Lead, YoungInnovations

http://anjhero.me

5+ years in UI design and development

Page 5: Training Session 2

Prawesh Shrestha Project Manager, YoungInnovations

3+ years Manager for Mobile Nepal

Page 6: Training Session 2

Mobile Nepal Community Common Platform to share, learn and grow

Events Hello Sarkar M2Work Hackathon Pivot Nepal NASA Space Apps

http://mobilenepal.net

Page 7: Training Session 2

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

Page 8: Training Session 2

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

Page 9: Training Session 2

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.

Page 10: Training Session 2

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?

Page 11: Training Session 2

INSTALLATION

Page 12: Training Session 2

The official development environment Google recommends for Android

Java SDK Android SDK Android Eclipse IDE

Page 13: Training Session 2

The official development environment Google recommends for Android

Java SDK Android SDK Android Eclipse IDE

Installed Together is the

ADT Bundle

Page 14: Training Session 2

Installed Together is the

ADT Bundle

PREREQUISITES Java SDK and the Java Runtime Environment

http://bit.ly/bMkbpo

Page 15: Training Session 2

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

Unzip and Extract

Navigate to the “eclipse” folder to launch eclipse

Page 16: Training Session 2

Development demands packages which can be downloaded from SDK Manager

Page 17: Training Session 2

Select these boxes.

Also, select -  Doc, Samples,

Intel -  Optional

-  Android Support Library

-  Google USB Driver

Select Install Packages

Page 18: Training Session 2

TESTING ON

EMULATORS

Page 19: Training Session 2

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

Page 20: Training Session 2

Setting up Emulator

Page 21: Training Session 2

AVD Manager

Page 22: Training Session 2

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

Page 23: Training Session 2

Running the Emulator

Page 24: Training Session 2

AVD Manager

Page 25: Training Session 2

TIME TO

PROGRAM

Page 26: Training Session 2

SETTING UP THE PROJECT

Page 27: Training Session 2

SETTING UP THE PROJECT

Page 28: Training Session 2

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

Page 29: Training Session 2

Getting started

Create the UI for our application.

1

2 Make the UI functional

xml  

java  

Page 30: Training Session 2

xml   java  

UI Instatiation

UI Functions

Page 31: Training Session 2

Guidelines

Page 32: Training Session 2

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.

Page 33: Training Session 2

Refer to your layout in your src with this

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

Page 34: Training Session 2

Refer to the Button declared earlier

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

Page 35: Training Session 2

Manipulating the Button

button.setOnClickListener( … );

Page 36: Training Session 2

Displaying the Short Popup

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

Page 37: Training Session 2

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);

Page 38: Training Session 2

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