Download Practical No – 6 (Elective-IV C)

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Group-A
Practical No – 6 (Elective-IV C)
Title: Write a mobile application to generate a scientific calculator using J2ME/ Python/
Scala/ C++/ Android.
Theory:
1. INTRODUCTION
1.1 ANDROID OS:
Android is a mobile operating system (OS) based on the Linux kernel and
currently developed by Google. With a user interface based on direct manipulation,
Android is designed primarily for touchscreen mobile devices such as smartphones and
tablet computers, with specialized user interfaces for televisions (Android TV), cars
(Android Auto), and wrist watches (Android Wear). The OS uses touch inputs that
loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse
pinching to manipulate on-screen objects, and a virtual keyboard. Despite being
primarily designed for touchscreen input, it also has been used in game consoles, digital
cameras, and other electronics.
Android's source code is released by Google under open source licenses,
although most Android devices ultimately ship with a combination of open source and
proprietary software. Initially developed by Android, Inc., which Google backed
financially and later bought in 2005,Android was unveiled in 2007 along with the
founding of the Open Handset Alliance—a consortium of hardware, software, and
telecommunication companies devoted to advancing open standards for mobile devices.
1.2 Eclipse IDE:
In computer programming, Eclipse is an integrated development environment (IDE). It
contains a base workspace and an extensible plug-in system for customizing the
environment. Written mostly in Java, Eclipse can be used to develop applications. By
means of various plug-ins, Eclipse may also be used to develop applications in other
programming languages: Ada, ABAP, C, C++, COBOL, Fortran, Haskell, JavaScript,
Lasso, Natural, Perl, PHP, Prolog, Python, R, Ruby (including Ruby on Rails
framework), Scala, Clojure, Groovy, Scheme, and Erlang. It can also be used to develop
packages for the software Mathematica. Development environments include the Eclipse
Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++ and Eclipse
PDT for PHP, among others.
1.3 ADT :
Android Development Tools (ADT) is a plugin for the Eclipse IDE that is d esigned to
give you a powerful, integrated environment in which to build Android applications.
ADT extends the capabilities of Eclipse to let you quickly set up new Android projects,
create an application UI, add packages based on the Android Framework API, debug
your applications using the Android SDK tools, and even export signed (or
unsigned) .apk files in order to distribute your application.
1.4 Android Emulator :
The Android SDK includes a mobile device emulator — a virtual mobile device that
runs on your computer. The emulator lets you develop and test Android applications
without using a physical device.
1.5 Android History :

Alpha (1.0)

Beta (1.1)

Cupcake (1.5)

Donut (1.6)

Eclair (2.0–2.1)

Froyo (2.2–2.2.3)

Gingerbread (2.3–2.3.7)

Honeycomb (3.0–3.2.6)

Ice Cream Sandwich (4.0–4.0.4)

Jelly Bean (4.1–4.3.1)

KitKat (4.4–4.4.4)
1.6 Android Architecture:
Linux kernel
At the bottom of the layers is Linux - Linux 2.6 with approximately 115 patches. This
provides basic system functionality like process management, memory management, device
management like camera, keypad, display etc. Also, the kernel handles all the things that
Linux is really good at such as networking and a vast array of device drivers, which take the
pain out of interfacing to peripheral hardware.
Libraries
On top of Linux kernel there is a set of libraries including open-source Web browser engine
WebKit, well known library libc, SQLite database which is a useful repository for storage
and sharing of application data, libraries to play and record audio and video, SSL libraries
responsible for Internet security etc.
Android Runtime
This is the third section of the architecture and available on the second layer from the bottom.
This section provides a key component called Dalvik Virtual Machine which is a kind of Java
Virtual Machine specially designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory management and multithreading, which is intrinsic in the Java language. The Dalvik VM enables every Android
application to run in its own process, with its own instance of the Dalvik virtual machine.
The Android runtime also provides a set of core libraries which enable Android application
developers to write Android applications using standard Java programming language.
Application Framework
The Application Framework layer provides many higher-level services to applications in the
form of Java classes. Application developers are allowed to make use of these services in
their applications.
Applications
You will find all the Android application at the top layer. You will write your application to
be installed on this layer only. Examples of such applications are Contacts Books, Browser,
Games etc..
1.7 Application Development
An application usually consists of multiple activities that are loosely bound to each other.
Typically, one activity in an application is specified as the "main" activity, which is presented
to the user when launching the application for the first time. Each activity can then start
another activity in order to perform different actions.
An Activity is an application component that provides a screen with which users can
interact in order to do something, such as dial the phone, take a photo, send an email, or view
a map. Each activity is given a window in which to draw its user interface.
Creating an Activity
To create an activity, you must create a subclass of Activity (or an existing subclass of
it). In your subclass, you need to implement callback methods that the system calls when the
activity transitions between various states of its lifecycle, such as when the activity is being
created, stopped, resumed, or destroyed. The two most important callback methods are:
onCreate()
You must implement this method. The system calls this when creating your activity.
Within your implementation, you should initialize the essential components of your activity.
Most importantly, this is where you must call setContentView() to define the layout for the
activity's user interface.
onPause()
The system calls this method as the first indication that the user is leaving your
activity (though it does not always mean the activity is being destroyed). This is usually
where you should commit any changes that should be persisted beyond the current user
session (because the user might not come back).
1.8 Activity Lifecycle
An activity can exist in essentially three states:
Resumed
The activity is in the foreground of the screen and has user focus. (This state is also
sometimes referred to as "running".)
Paused
Another activity is in the foreground and has focus, but this one is still visible. That is,
another activity is visible on top of this one and that activity is partially transparent or doesn't
cover the entire screen. A paused activity is completely alive (the Activity object is retained
in memory, it maintains all state and member information, and remains attached to the
window manager), but can be killed by the system in extremely low memory situations.
Stopped
The activity is completely obscured by another activity (the activity is now in the
"background"). A stopped activity is also still alive (the Activity object is retained in
memory, it maintains all state and member information, but is not attached to the window
manager). However, it is no longer visible to the user and it can be killed by the system when
memory is needed elsewhere.
1.9 Classes and Methods
Activity Class
An activity is a single, focused thing that the user can do. Almost all activities interact
with the user, so the Activity class takes care of creating a window for you in which you can
place your UI with setContentView(View). While activities are often presented to the user as
full-screen windows, they can also be used in other ways: as floating windows (via a theme
with windowIsFloating set) or embedded inside of another activity (using ActivityGroup).
There are two methods almost all subclasses of Activity will implement:
onCreate(Bundle) is where you initialize your activity. Most importantly, here you
will usually call setContentView(int) with a layout resource defining your UI, and using
findViewById(int) to retrieve the widgets in that UI that you need to interact with
programmatically.
onPause() is where you deal with the user leaving your activity. Most importantly,
any changes made by the user should at this point be committed (usually to the
ContentProvider holding the data).
To be of use with Context.startActivity(), all activity classes must have a
corresponding <activity> declaration in their package's AndroidManifest.xml.
setContentView(View view)
This method belongs to class activity
Set the activity content to an explicit view.
Conclusion: