1.MAD LAB Manual

Cs3271 c lab manual ucetk

TOTAL: 60 PERIODS OUTCOMES: At the end of the course, the student should be able to:

  1. Design and Implement various mobile applications using emulators.
  2. Deploy applications to hand-held devices

LIST OF EQUIPMENT FOR A BATCH OF 30 STUDENTS

Standalone desktops with Windows or Android or iOS or Equivalent Mobile Application Development Tools with appropriate emulators and debuggers - 30 Nos.

Introduction

Android is a mobile operating system that is based on a modified version of Linux.

Android, as a system, is a Java-based operating system that runs on the Linux kernel. The

system is very lightweight and full featured.

It was originally developed by a startup of the same name, Android, Inc. In 2005, as

part of its strategy to enter the mobile space, Google purchased Android and took over its

development work. Google wanted Android to be open and free; hence, most of the Android

code was released under the open source Apache License, which means that anyone who

wants to use Android can do so by downloading the full Android source code.

The main advantage of adopting Android is that it offers a unified approach to

application development. Developers need only develop for Android, and their applications

should be able to run on numerous different devices, as long as the devices are powered

using Android.

The Android SDK includes a variety of tools that help us develop mobile applications

for the Android platform. The tools are classified into two groups:

a) SDK tools

b) Platform tools

SDK tools are platform independent and are required no matter which Android platform we

are developing on. Platform tools are customized to support the features of the latest Android

platform.

Android Development Tools (ADT) is a plug-in for the Eclipse IDE that provides a

suite of tools that are integrated with the Eclipse IDE. It offers access to many features that

are helpful for developing Android applications. It extends the capabilities of Eclipse to let

us quickly set up new Android projects, create an application UI, add packages based on the

Andro--id Framework API, debug our applications using the Android SDK tools, and even

export signed (or unsigned) .apk files in order to distribute our application. Before we install

or use ADT, we need to check that whether we have compatible versions of both the Eclipse

IDE and the Android SDK installed.

Configuration steps:

1 help, click install new software, Enter URL

Work with : dl-ssl.google/android/eclipse

2. Click add, a wizard named Add Respiratory will open ,then type

“ADT_Plugin” in the name textbox.

3 the procedure and restart the software,

Window→ preference→ check for sdk folder on sdk location choose → apply→OK

4 Virtual Device Creation (to display android output),

Window→ Android Virtual Device Manager → Create→

Configure as follows,

Device : 5” WVGA (480*800;mdpi)

Target : Android 4.4-API level 19

CPU/ABI : ARM (armeabi-v7a)

Skin : WQVGA

RAM : 512 mb

VM Heap : 16

EXERCISE – 1
GUI COMPONENTS, FONTS AND COLORS

Aim: To Develop an application that uses GUI components, Font and Colours

List of Apparatus Hardware: 1 Personal Computer /user Software: 1. Eclipse 2. Andriod SDK 3. Java runtime Environment 1.

Principle App’s user interface is everything that the user can see and interact with. Android provides a variety of pre-build UI components such as structured layout objects and UI controls that allow us to build the graphical user interface for our app. Android also provides other UI modules for special interfaces such as dialogs, notifications, and menus.

Steps Step 1:Open Eclipse and select new andriod project Step 2: Give Project name and Select next Step 3: Choose the andriod version. Choose lowest andriod version. Step 4: Enter Package name. packagename must be two word separated by comma and click finish. Step 5:Go to package Explorer and select our project. Step 6: Click res directory -> layout -> activity_main -> Design Step 7: Insert the GUI components to Design (or) write xml code in activity_main Step 8: Click src directory -> Main_activity and write java code Step 9: Run the android application and the output is present in the android emulator

MainActivity package com.example;

import android.os; import android.app; import android.graphics; import android.view; import android.widget; import android.widget;

setContentView(R.layout_main); final TextView t1=(TextView)findViewById(R.id); Button b1=(Button) findViewById(R.id); Button b2=(Button) findViewById(R.id); b1(new View()

LAYOUT MANAGERS AND EVENT LISTENERS

Aim: To develop an application that uses Layout Managers and event listeners.

List of Apparatus Hardware: 1 Personal Computer /user Software: 1. Eclipse 2. Andriod SDK 3. Java runtime Environment 1.

Principle A layout defines the visual structure for a user interface, such as the UI for an activity or app widget. Events are a useful way to collect data about user's interaction with interactive components of applications like button press, screen touch etc. The android framework maintains an event queue as first-in, first-out (FIFO) basis. Algorithm:

Step 1:Open Eclipse and select new andriod project Step 2: Give Project name and Select next Step 3: Choose the andriod version. Choose lowest andriod version. Step 4: Enter Package name. packagename must be two word separated by comma and click finish. Step 5:Go to package Explorer and select our project. Step 6: Click res directory -> layout -> activity_main -> Design Step 7: Insert the GUI components to Design (or) write xml code in activity_main Step 8: Click src directory -> Main_activity and write java code Step 9: Run the android application and the output is present in the android emulator

zero(this); nine(this); eig(this); sev(this); six(this); fiv(this); four(this); thr(this); two(this); one(this); dot(this); plus(this); mins(this); div(this); mul(this); eq(this); cl(this); et(this); >

case R.id: case R.id: case R.id: case R.id: case R.id: case R.id: case R.id:

String inDigit = ((Button) v).getText().toString(); if (s("0")) < s = inDigit; >else < s += inDigit; >et(s); if (lO == '=') < result = 0; lO = ' '; >break; case R.id: compute(); lO = '+'; break; case R.id: compute(); lO = '-'; break; case R.id: compute(); lO = '/'; break; case R.id: compute(); lO = '*'; break; case R.id: compute(); lO = '='; break; case R.id: result = 0; s = "0"; lO = ' '; et("0"); break; > >