0% found this document useful (0 votes)
13 views36 pages

Setting Up Android Development Environment

The document provides an overview of setting up the development environment for Android development. It discusses downloading and installing the Java Development Kit (JDK), Eclipse, and the Android Software Development Kit (SDK). It then explains how to configure the Eclipse plugin for Android and the SDK. The document also summarizes the key components of a basic "Hello World" Android app, including the package, imports, Activity class, and layout XML.

Uploaded by

sadaf_saad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views36 pages

Setting Up Android Development Environment

The document provides an overview of setting up the development environment for Android development. It discusses downloading and installing the Java Development Kit (JDK), Eclipse, and the Android Software Development Kit (SDK). It then explains how to configure the Eclipse plugin for Android and the SDK. The document also summarizes the key components of a basic "Hello World" Android app, including the package, imports, Activity class, and layout XML.

Uploaded by

sadaf_saad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Android Development

Day - 2

1
Agenda
Session 1
Introduction to Android Stack
How to Set-Up Development Environment
Setup JDK
Setup Eclipse
Setup Android SDK and Emulator/s

Session 2
Practically set-up the dev-environment
Running a Hello Android Program
Understanding different components of Hello Android
Android Software Development

Java Programming Language


Object Oriented Concepts

3
Android Architecture

4
Application Framework
Developers
can build extremely rich and innovative
applications
have full access to framework APIs

5
Application Framework

Underlying all applications is a set of


services and systems, including:
Views
Content Providers
Resource Manager
Notification Manager
Activity Manager

6
Application Components
no main() function
There are four types of components:
Activities
Services.
Broadcast Receivers
Content providers

7
Types of Android Applications
Foreground Apps
Background
Services and intent receivers
Intermittent
Widget
Developing for Mobile
Hardware imposed design consideration
Low processing power
Limited RAM
Limited storage
Small Screen
High costs of use
Slow data rates
Unreliable Data connection
Limited Battery Life
Mobile Development
Best Practices
Try your best to accommodate the limitations
Be prepared for unreliability
Expect low speeds and high latency
Keep the costs low wherever possible
Make seamless and easy UIs
Android Development Philosophy
Android design philosophy expects apps are designed
for:
Performance
Responsiveness
Seamlessness
Security
Development Kickstart
Step 1 – Downloads:

JDK 5 or 6
[Link]
oads/[Link]

Eclipse
[Link]

Andriod SDK
[Link]
12
Development Kickstart
Step 2: Install and unzip

Install JDK/Eclipse for Java


Unzip the Eclipse Plugin

13
Development Kickstart
Step 3 – Configure Eclipse and SDK

This includes
Configure Eclipse Plugin for Android
Configure SDK with Eclipse

14
Downloading
Download JDK
Download SDK
Download Eclipse
Configuring Dev Environment
Install JDK
Unzip Eclipse
Add Eclipse Plugin,
How?
Adding Eclipse Plugin
Goto Help Menu
Click Install
Software
Configuring Eclipse
Type following URL
[Link]
Press Add
Wait for the components to load
Select all checkboxes and install the software
Configure Android SDK

19
And you are ready to develop
Lets make a
Hello Android

.........

21
Understanding Hello Example
package com.test9;

import [Link];
import [Link];

public class activity9 extends Activity {


/** Called when the activity is first created. */

public void onCreate(Bundle savedInstanceState) {


[Link](savedInstanceState);
setContentView([Link]);
}
}

22
Package and Imports
package com.test9;

import [Link];
import [Link];

23
Activity

public class activity9 extends Activity {

24
onCreate over-ride

public void onCreate(Bundle savedInstanceState) {


[Link](savedInstanceState);
setContentView([Link]);
}

25
Where did the Hello string come from?

setContentView([Link]);

This line inflates a Layout Resource already defined


for the user interface layout design.

26
Layout
Layouts can be defined in two ways:

As an XML layout resource

Programmatically in the code

27
[Link] for Hello Project
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="[Link]
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>

28
Understanding Layout XML
XML defines which layout you are using
LinearLayout being used right now (we will see other
layouts later)
XML tells you which components to add to the screen,
for examole:
Buttons
Text boxes and text areas
List boxes etc
What does the XML say?

This screen has a Linear Layout


The main view fills the whole screen horizontally and
vertically
This screen has a TextView
Textview fits the height
Why UI in XML?
UI design is done independent of programming
language
Decouples our UI design from your code

Benefits?
Users can work in parallel developing the UI xml and
code.
Resource Types

XML Layouts ([Link])


String value pairs ([Link])
Drawable icons and images ([Link])
String Value Pairs
String value pairs define constants and values that you
need to have initially loaded into the system.

<?xml version="1.0" encoding="utf-8"?>


<resources>
<string name="hello">Hello World, activity!</string>
<string name="app_name">TestApp</string>
</resources>
TextView value

="@string/hello”
Creating the same layout via code
public void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);

[Link] lp;
lp = new
[Link](LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);

[Link] textViewLP;
textViewLP = new
[Link](LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
LinearLayout ll = new LinearLayout(this);

[Link]([Link]);

TextView myTextView = new TextView(this);


[Link]("Hello World, HelloWorld");

[Link](myTextView, textViewLP);
[Link](ll, lp);
}

You might also like