Internship App
Internship App
Table of Contents
1. Introduction to Mobile Technologies………………………………….…….01
1.1 Background about Mobile Technologies
1.2 Android
1.3 Mobile Application
2. Introduction to Android………………………………………….………….03
2.1 Android Architecture
3. Android Building Blocks……………………………………………………06
4. Introduction to the Development tool “Android Studio” ………...…………10
5. Android UI Design………………………………………………………….11
6. Database SQLite…………………………………………………………….14
7. Software Requirement Specification……………………………………….17
7.1 Introduction
7.2 Overall Description
7.3 Specific Requirements
7.4 Change Management Process
7.5 Database Schema
8. Design……………………………………………………………………….21
9. Conclusion………………………………………………………………….23
1. Introduction to Mobile Technologies
1.1 Background about Mobile Technologies
Mobile technology is the technology used for cellular communication. Since the
start of this millennium, a standard mobile device has gone from being no more
than a simple two-way pager to being a mobile phone, GPS navigation device,
an embedded web browser and instant messaging client, and a handheld game
console. Many types of mobile operating systems are available for smart
phones, including Android, BlackBerry OS, iOS, Symbian, Windows Mobile
and Bada.
1.2 Android
Android is an operating system based on Linux with a Java programming
interface. Android is a mobile operating system (OS) developed by Google.
Android is the first completely open source mobile OS. Building on the
contributions of the open-source Linux community and more than 300
hardware, software, and carrier partners, Android has rapidly become the
fastest-growing mobile OS.
5. Android UI Design
5.1 Introducing Layouts
Frame Layout
Frame layouts are one of the simplest layout types used to organize controls
within the user interface of an Android application. They are used less often
than some other layouts, simply because they are generally used to display only
one view, or views which overlap. The efficiency of a frame layout makes it a
good choice for screens containing few view controls (home screens, game
screens with a single canvas, and the like). Sometimes other inefficient layout
designs can be reduced to a frame layout design that is more efficient, while
other times a more specialized layout type is appropriate. Frame layouts are the
normal layout of choice when you want to overlap views.
Linear Layout
Linear layouts are one of the simplest and most common types of layouts used
by Android developers to organize controls within their user interfaces. The
linear layout works much as its name implies: it organizes controls linearly in
either a vertical or horizontal fashion. When the layout’s orientation is set to
vertical, all child controls within it are organized in a single column; when the
layout’s orientation is set to horizontal, all child controls within it are organized
in a single row. Some of the most important attributes you’ll use with linear
layouts include:
The orientation attribute (required), which can be set to vertical or
horizontal.
The gravity attribute (optional), which controls how all child controls are
aligned and displayed within the linear layout (class: LinearLayout).
The layout_weight attribute (optional, applied to each child control)
specifies each child control’s relative importance within the parent linear
layout (class: LinearLayout.LayoutParams).
Relative Layout
The relative layout works much as its name implies: it organizes controls
relative to one another, or to the parent control itself. It means that child
controls, such as ImageView, TextView, and Button controls, can be placed
above, below, to the left or right, of one another. Child controls can also be
placed in relation to the parent (the relative layout container); including
placement of controls aligned to the top, bottom, left or right edges of the
layout.
Some specific attributes apply to relative layouts-namely the child rules,
including:
Rules for child control centering within the parent layout, including:
center horizontally, center vertically, or both.
Rules for child control alignment within the parent layout, including:
align with top, bottom, left or right edge of another control.
Rules for child control alignment in relation to other child controls,
including: align with top, bottom, left or right edge.
Rules for child control placement in relation to other child controls,
including: placement to the left or right of a specific control, or above or
below another control.
Table Layout
A table layout is exactly what you might expect: a grid of made up of rows and
columns, where a cell can display a view control. From a user interface design
perspective, a TableLayout is comprised of TableRow controls—one for each
row in your table. The contents of a TableRow are simply the view controls that
will go in each “cell” of the table grid. Although table layouts can be used to
design entire user interfaces, they usually aren’t the best tool for doing so, as
they are derived from LinearLayout and not the most efficient of layout
controls. However, for data that is already in a format suitable for a table, such
as spreadsheet data, table layout may be a reasonable choice.
5.2 Different UI widgets available in Android
Text View
Edit Text
List View
Spinner
Button
Check Box
Radio Button
Scroll View
5.3 Menus
Options menu and action bar The options menu is the primary collection of
menu items for an activity. It's where you should place actions that have a
global impact on the app, such as “Search”, “Compose email”, and “Settings”.
On Android 3.0 and higher, items from the options menu are presented by the
action bar as a combination of on-screen action items and overflow options.
Beginning with Android 3.0, the Menu button is deprecated (some devices don't
have one), so you should migrate toward using the action bar to provide access
to actions and other options.
Context Menu and Contextual Action Mode
A context menu is a floating menu that appears when the user performs a long-
click on an element. It provides actions that affect the selected content or
context frame. A contextual menu offers actions that affect a specific item 13 or
context frame in the UI. You can provide a context menu for any view, but they
are most often used for items in a ListView, GridView, or other view collections
in which the user can perform direct actions on each item.
Popup Menu
A popup menu displays a list of items in a vertical list that's anchored to the
view that invoked the menu. It's good for providing an overflow of actions that
relate to specific content or to provide options for a second part of a command.
5.4 Dialog Box
A dialog is a small window that prompts the user to make a decision or enter
additional information. A dialog does not fill the screen and is normally used for
modal events that require users to take an action before they can proceed.
5.5 Toast
A toast provides simple feedback about an operation in a small popup. It only
fills the amount of space required for the message and the current activity
remains visible and interactive.
5.6 Adapters
An Adapter acts as a bridge between a ListView and the underlying data for that
view. The Adapter provides access to the data items. The Adapter is also
responsible for making a View for each item in the data set.
Array Adapter
Array Adapter is a concrete BaseAdapter that is backed by an array of arbitrary
objects. By default this class expects that the provided resource id references a
single TextView. If you want to use a more complex layout, use the constructor
that also takes a field id. That field id should reference a TextView in the larger
layout resource.
5.7 Notification Manager
A notification is a message you can display to the user outside of your
application's normal UI. When you tell the system to issue a notification, it first
appears as an icon in the notification area. To see the details of the notification,
the user opens the notification drawer. Notification Manager Class is used to
notify the user of events that happen. This is how you tell the user that
something has happened in the background. Notifications can take different
forms:
A persistent icon that goes in the status bar and is accessible through the
launcher, (when the user selects it, a designated Intent can be launched).
Turning on or flashing LEDs on the device.
Alerting the user by flashing the backlight, playing a sound, or vibrating.
6. Database SQLite
SQLite is an Open-Source database. SQLite supports standard relational
database features like SQL syntax, transactions and prepared statements. The
database requires limited memory at runtime (approx. 250 Kbytes) which makes
it a good candidate from being embedded into other runtimes.
SQLite is embedded into every Android device. Using a SQLite database in
Android does not require a setup procedure or administration of the database.
We only have to define the SQL statements for creating and updating the
database. Afterwards the database is automatically managed for us by the
Android platform. If our application creates a database, this database is by
default saved at directory - DATA/data /APP_NAME/ databases /FILENAME.
SQLiteDatabase is the base class for working with a SQLite database in
Android and provides methods to open, query, update and close the database.
SQLiteDatabase provides the insert(), update() and delete() methods.
The object ContentValues allows to define key/values. The key
represents the table column identifier and the value represents the
content for the table record in this column. ContentValues can be used
for inserts and updates of database entries.
Queries can be created via the rawQuery() and query() methods or via
the SQLiteQueryBuilder class .
rawQuery() directly accepts an SQL select statement as input.
query() provides a structured interface for specifying the SQL query.
SQLiteQueryBuilder is a convenience class that helps to build SQL
queries.
6.1 SQLiteOpenHelper
To create and upgrade a database in our Android application we create a
subclass of the SQLiteOpenHelper class. In the constructor of our subclass we
call the super() method of SQLiteOpenHelper, specifying the database name
and the current database version. In this class we need to override the following
methods to create and update our database-
onCreate() is called by the framework, if the database is accessed but not
yet created.
onUpgrade() called, if the database version is increased in your
application code. This method allows you to update an existing database
schema or to drop the existing database and recreate it via the onCreate()
method.
6.2 Query()
The following gives an example of a query() call-
return database.query(DATABASE_TABLE, new String[] { KEY_ROWID,
KEY_CATEGORY, KEY_SUMMARY, KEY_DESCRIPTION }, null, null,
null, null, null);
6.3 Opening and Closing a Database
SQLiteDatabase db = this.getWritableDatabase(); //Opening
DatabaseConnection
ContentValues values = new ContentValues();
values.put(KEY_NAME, contact.getName()); //Contact Name
values.put(KEY_PH_NO, contact.getPhoneNumber()); //Contact Phone
Number
db.insert(TABLE_CONTACTS, null, values); //Inserting Row
db.close(); //Closing database connection
6.4 Cursor
Cursor provides typed get*() methods, e.g. getLong(columnIndex),
getString(columnIndex) to access the column data for the current position of the
result. The "columnIndex" is the number of the column you are
accessing. A Cursor needs to be closed with the close() method call.
Insert
ContentValues values = new ContentValues();
values.put(MySQLiteHelper.COLUMN_COMMENT, comment);
long insertId = database.insert(MySQLiteHelper.TABLE_COMMENTS, null,
values);
cursor.close();
return newComment;
Delete
database.delete(MySQLiteHelper.TABLE_COMMENTS,
MySQLiteHelper.COLUMN_ID + " = " + id, null);
6.5 Content provider and Sharing data
An SQLite database is private to the application which creates it. If you want to
share data with other applications you can use a content provider. A content
provider allows applications to access data. In most cases this data is stored in
an SQlite database. While a content provider can be used within an application
to access data, it is typically used to share data with other application. As
application data is by default private, a content provider is a convenient to share
your data with other application based on a structured interface. A content
provider must be declared in the AndroidManifest.xml file.
9. Conclusion
Android Smartphone are in hype in the 21st century. The scope of android
applications is increasing day by day. Its development has become an essential
part of today’s programming curriculum. The project HealthyMe is an android
app that incorporates everything from UI design to database. Its utility and
efficiency are also very high. More such android apps can be developed using
similar concepts and tools. The society has a dearth of ideas. These ideas can be
most effectively implemented by developing user-friendly android applications.
Through this project, we got to learn a lot, including, database connectivity
using SQLite. Being new to app development, we came to know a lot about
developing an android application from scratch.