Professional Documents
Culture Documents
INTRODUCTION
1
1.1 MOTIVATION
As we know that now a days most of communication is mobile based commu-
nication so we want to do an application in mobile platform. By observing all the mo-
bile operating systems we found that Android is the most used operating system. So
we selected this project to have some knowledge on the latest platform (ANDROID),
current technologies which are going on now and want to design a Good application.
One of the fastest growing industries now a day is mobile industry. There are
many competitors in this area who are doing research and development on new plat-
forms & user experience. One such technology is Android from Google which is sup-
ported for many manufactured phones. One of the fastest growing industries now a day
is mobile industry. There are many competitors in this area who are doing research and
development on new platforms & user experience. One such technology is Android
from Google which is supported for many manufactured phones. These phones are
described as next Generation mobiles [As described by Google].
The project is develop a mobile application which provides contact information about
a student and their parents .This application will also be used as base for further mod-
ification in which it would be used to manage the complete contact details of each and
every member of the college .
3
2.1 LITERATURE SURVEY
Android is a software stack for mobile devices that includes an operating system, mid-
dleware and key applications. The android SDK provides the tools and APIs necessary
to begin developing applications on the Android platform using the Java programming
language.
The Android SDK includes a comprehensive set of development tools. These include
a debugger, libraries, a handset emulator (based on QEMU), documentation, sample
code, and tutorials. Currently supported development platforms include x86-architec-
ture computers running Linux (any modern desktop Linux distribution), Mac OS X
10.4.8 or later, Windows XP or Vista. The officially supported integrated development
environment (IDE) is Eclipse (3.2 or later) using the Android Development Tools
(ADT) Plug in, though developers may use any text editor to edit Java and XML files
then use command line tools to create, build and debug Android applications.
By observing all the mobile operating systems we found that Android is the most used
operating system. So we selected this project to have some knowledge on the latest
platform (ANDROID), current technologies which are going on now and want to de-
sign a Good application.
World is contracting with the growth of mobile phone technology. As the number of
users is increasing day by day, facilities are also increasing. Starting with simple reg-
ular handsets which were used just for making phone calls, mobiles have changed our
lives and have become part of it. Now they are not used just for making calls but they
have innumerable uses and can be used as a Camera , Music player, Tablet PC, T.V. ,
Web browser etc
Android comes with an Android market which is an online software store. It was de-
veloped by Google. It allows Android users to select, and download applications de-
veloped by third party developers and use them. There are around 2.0 lack+ games,
application and widgets available on the market for users.
4
Android applications are written in java programming language. Android is available
as open source for developers to develop applications which can be further used for
selling in android market. There are around 200000 applications developed for android
with over 3 billion+ downloads. Android relies on Linux version 2.6 for core system
services such as security, memory management, process management, network stack,
and driver model. For software development, Android provides Android SDK (Soft-
ware development kit)
APPLICATIONS :
These are the basics of Android applications:
Android applications are composed of one or more application components (ac-
tivities, services, content providers, and broadcast receivers)
Each component performs a different role in the overall application behaviour,
and each one can be activated individually (even by other applications)
The manifest file must declare all components in the application and should also
declare all application requirements, such as the minimum version of Android required
and any hardware configurations required
Non-code application resources (images, strings, layout files, etc.) should include
alternatives for different device configurations (such as different strings for different
languages)
LIBWEB CORE - a modern web browser engine which powers both the android
browser and embeddable view
7
SGL- the underlying 2D graphics engine
DALVIK VIRTUAL MACHINE:Dalvik has been written so that a device can run
multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executa-
ble (.dex) format which is optimized for minimal memory footprint.
8
APPLICATION FRAMEWORK: By providing an open development platform, An-
droid offers developers the ability to build extremely rich and innovative appli-
cations.
9
SERVICES : A service should be used for any application that needs to persist for a
long time, such as a network monitor or update-checking application.
The lifeline for every Android application is its database support. A database
system is needed to store structured data, unless the application deals only with
simple data. Android uses the SQLite database system, which is an open-source,
stand-alone SQL database, widely used by many popular applications. SQLite
is a lightweight transactional database engine that occupies a small amount of
disk storage and memory, thus, it is a perfect choice for creating databases on
many mobile operating systems such as Android and iOS.
10
The database that is created for an application is only accessible to itself; other appli-
cations will not be able to access it. Once created, the SQLite database is stored in the
/data/data/<package_name>/databases folder of an Android device.
11
The recommended method to create a new SQLite database is to create a subclass of
SQLiteOpenHelper and override the onCreate() method, in which and SQLite com-
mand is executed to create tables in the database. An example is shown in Figure 4.
You can then get an instance of the SQLiteOpenHelper implementation using the con-
structor that is being defined. To write to and read from the database, the getWrita-
bleDatabase() and getReadableDatabase() are called, respectively. Both returns an
SQLiteDatabase object that represents the database and provides methods for SQLite
operations.
SQLite queries can be executed using the SQLiteDatabase query() methods, which ac-
cept various query parameters, such as the table to query, the projection, selection,
columns, grouping, and others. For complex queries, such as those that require column
aliases, the SQLiteQueryBuilder is used, which provides several convenient methods
for building queries.
Every SQLite query will return a Cursor that points to all the rows found by the query.
The Cursor is always the mechanism with which can navigate results from a database
query and read rows and columns [7].
12
2.7 OTHER DATABASES :
Cellica Database for Android allows viewing and updating the database contents on an
Android device. It allows to sync with Microsoft Access, Microsoft Excel, and any
ODBC Compliant database like Oracle, SQL Server etc. The software package consists
of two software: the Cellica Database Desktop (Server) that runs on Microsoft Win-
dows, and Android device Cellica Database (Client) that run on the Android device.
The Desktop side software is used to create the database profiles (make the list of da-
tabase) for Android phone/ Tablet and data will be synchronizing with Android
phone/Tablet depending on the sync settings on phone/Tablet [8].
Cellica Database on Android phone/Tablet features include synchronized data wire-
lessly with Android phone/Tablet, view and update data, apply SQL Select queries,
filters, sort the fields and synchronize data accordingly, supported password protection,
supported forms, custom database creation, and so on.
Memento is a personal database that allows Android users to store all personal data in
one place. Entries can be synchronized with Google Docs. For example, Memento han-
dles collections, purchases, inventory, recipes, and tasks. Main features include storing
entries with custom fields, sorting, grouping and filtering entries by any fields, pass-
word protection, synchronization with Google docs, sending entries via SMS, e- mail
and other available devices, barcode scanning, backing up entries and restoring data,
and so on.
13
CHAPTER 3
ANALYSIS
14
3.1 INTRODUCTION
System analysis refers to analysing the projects hardware and software require-
ments. It is often done for diagnostic or troubleshooting purposes. Running a system
analysis can also be helpful when determining if the project meets all the desired re-
quirements.
1. Generally all the communication details of the students are stored in a database and
whenever they or their parents need to be contacted the information needs to be
searched in the database and retrieved. Then proper means of communication has to
be adopted.
2. We have a phone directory but opening that and storing names and contact details
of individual students is a long process. For each and every student their contact de-
tails needs to be stored and a separate contact of their parent also needs to be created.
Both the methods are time consuming and there is also a chance of loss of data.Also
proper maintenance of the information is needed and proper storage and retrieval
techniques needs to be applied in order to maintain the consistency of database.
The aim of our mini project is to develop a mobile application which contains the
contact details of the students and also their parents in an embedded database. This
would help the faculties to contact the student or their parents via a phone call , mes-
sage or an e-mail as and when its required .
15
ADVANTAGES OF PROPOSED SYSTEM
2.It doesn't require any maintenance to manage all the contact information
MONITOR : 15 COLOR
HARD DISK : 80 GB
16
CHAPTER 4
DESIGN
17
4.1 DESIGN DETAILS
The Unified Modeling Language (UML) offers a way to visualize a system's archi-
tectural blueprints in a diagram including elements such as:
It differs from the flowchart as it shows the data flow instead of the control
flow of the program.
A data flow diagram can also be used for the visualisation of data processing.
The DFD is designed to show how a system is divided into smaller portions
and to highlight the flow of data between those parts.
18
FIGURE : DATA FLOW DIAGRAM
19
USE CASE DIAGRAM
A use case diagram at its simplest is a representation of a user's interaction
with the system and depicting the specifications of use-case. A use case diagram can
portray the different types of users of a system and the various ways that they interact
with the system.
A use case diagram can also be defined as users interaction the system that shows the
relationship between the user and the different use cases in which the user is in-
volved. A use case diagram can identify the different types of users of a system and
the different use cases and will often be accompanied by other types of diagrams as
well.
IDENTIFYING ACTORS:
Actor is a role of an object
Actor:User
20
FIGURE: USECASE DIAGRAM
21
CLASS DIAGRAM
In software engineering, a class diagram in the Unified Modeling Language (UML)
is a type of static structure diagram that describes the structure of a system by showing
the system's classes, their attributes, operations (or methods), and the relationships
among the classes.
IDENTIFYING CLASES :
Class can be defined as a collection of objects that share common properties and rela-
tionships.
Class1: User
Class4: Communication
22
FIG-
URE : CLASS
DIA-
GRAM
OBJECT DIAGRAM
Object diagrams reflect class diagrams in terms of real time aspects.Addresses the data
structures and provide snapshots of instances of elements internal to a class diagram.
IDENTIFYING OBJECTS:
1. User
2. Student List
3. Contact Information
23
U:Us L:Lo
H:ho
24
COMPONENT DIAGRAM
The component diagram is used to address implementation view of the system that
is to be modelled.
IDENTIFYING OBJECTS :
1. Intel XDK
2. Notepad ++
3. Operating system
Notepad
Intel
Operatingsystem
25
DEPLOYMENT DIAGRAM
Deployment diagrams reflect static deployment view of the system.The nodes
which form the major entity of the deployment diagrams take in the components
corresponding to the component diagrams before finalizing the static framework of
the system.
IDENTIFYING NODES:
1. Processor
2. Android phone
26
CHAPTER 5
IMPLEMENTATION
27
5.1 MODULES
In this we have 4 modules:
1. GUI
2. Sending message to student or parent
3. Calling a parent or student message from database
4. Sending e-mails to the student
GUI
It has got a good graphical user interface. This GUI can be used to send message or e-
mails and make phone calls from the application easily.
SENDING E-MAILS
Mails can be sent easily with the support of inbuilt mailing apps.
28
5.3 TECHNOLOGIES USED
JAVA
Java is a set of computer software and specifications developed by Sun Microsystems,
which was later acquired by the Oracle Corporation, that provides a system for devel-
oping application software and deploying it in a cross-platform computing environ-
ment. Java is used in a wide variety of computing platforms from embedded devices
and mobile phones to enterprise servers and supercomputers. While they are less com-
mon than standalone Java applications, Java applets run in secure, sandboxed environ-
ments to provide many features of native applications and can be embedded in HTML
pages. Writing in the Java programming language is the primary way to produce code
that will be deployed as byte code in a Java Virtual Machine (JVM); byte code com-
pilers are also available for other languages, including Ada, JavaScript, Python, and
Ruby. In addition, several languages have been designed to run natively on the JVM,
including Scala, Clojure and Apache Groovy. Java syntax borrows heavily from C and
C++, but object-oriented features are modeled after Smalltalk and Objective-C. Java
eschews certain low-level constructs such as pointers and has a very simple memory
model where every object is allocated on the heap and all variables of object types are
references. Memory management is handled through integrated automatic garbage col-
lection performed by the JVM.
ANDROID STUDIO
Android Studio is the official integrated development environment (IDE) for An-
droid platform development.It was announced on May 16, 2013 at the Google I/O
conference. Android Studio is freely available under the Apache License 2.0.
Android Studio was in early access preview stage starting from version 0.1 in May
2013, then entered beta stage starting from version 0.8 which was released in June
2014.The first stable build was released in December 2014, starting from version 1.0.
29
Based on JetBrains' IntelliJ IDEA software, Android Studio is designed specifically
for Android development. It is available for download on Windows, Mac OS X and
Linux,and replaced Eclipse Android Development Tools (ADT) as Google's primary
IDE for native Android application development.
SQLITE DATABASE
SQLite is an embedded SQL database engine. Unlike most other SQL databases,
SQLite does not have a separate server process. SQLite reads and writes directly to
ordinary disk files. A complete SQL database with multiple tables, indices, triggers,
and views, is contained in a single disk file. The database file format is cross-platform
- you can freely copy a database between 32-bit and 64-bit systems or between big-
endian and little-endian architectures. These features make SQLite a popular choice
as an Application File Format. Think of SQLite not as a replacement for Oracle but as
a replacement for fopen().
SQLite is a compact library. With all features enabled, the library size can be less than
500KiB, depending on the target platform and compiler optimization settings. (64-bit
code is larger. And some compiler optimizations such as aggressive function inlining
and loop unrolling can cause the object code to be much larger.) If optional features
are omitted, the size of the SQLite library can be reduced below 300KiB. SQLite can
also be made to run in minimal stack space (4KiB) and very little heap (100KiB),
making SQLite a popular database engine choice on memory constrained gadgets such
as cellphones, PDAs, and MP3 players. There is a tradeoff between memory usage
and speed. SQLite generally runs faster the more memory you give it. Nevertheless,
performance is usually quite good even in low-memory environments.
30
5.4 SAMPLE CODE
MAINACTIVITY.JAVA
package com.saurabh.studentprofiles;
import android.annotation.TargetApi;
import android.app.ListActivity;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.SearchView;
import java.util.List;
public class MainActivity extends ListActivity {
public List<Student> students;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new LoadStudentsTask().execute();
}
private class LoadStudentsTask extends AsyncTask<String, Void, Cursor> {
31
@Override
protected Cursor doInBackground(String... args) {
Uri uri = StudentProvider.CONTENT_URI;
String[] projection = { StudentDatabase.COLUMN_ID, StudentDatabase.COL-
UMN_FIRSTNAME, StudentDatabase.COLUMN_LASTNAME, StudentData-
base.COLUMN_ROLL, StudentDatabase.COLUMN_DEPARTMENT,
StudentDatabase.COLUMN_FNAME, StudentDatabase.COLUMN_PAR-
ENT_PHONE, StudentDatabase.COLUMN_MOBILE_PHONE, StudentData-
base.COLUMN_EMAIL, StudentDatabase.COLUMN_PICTURE };
String selection = null;
String[] selectionArgs = null;
String sortOrder = StudentDatabase.COLUMN_ROLL + " COLLATE LOCALIZED
ASC";
Cursor cursor = getContentResolver().query(uri, projection, selection, selectionArgs,
sortOrder);
return cursor;
}
@Override
protected void onPostExecute(Cursor cursor) {
String[] dataColumns = {
StudentDatabase.COLUMN_FIRSTNAME,
StudentDatabase.COLUMN_ROLL,
StudentDatabase.COLUMN_DEPARTMENT,
StudentDatabase.COLUMN_FNAME,
StudentDatabase.COLUMN_PARENT_PHONE,
StudentDatabase.COLUMN_MOBILE_PHONE,
StudentDatabase.COLUMN_EMAIL,
StudentDatabase.COLUMN_PICTURE
};
int[] viewIDs = {
32
R.id.list_item_name,
R.id.list_item_title,
R.id.list_item_department,
R.id.list_item_city,
R.id.list_item_office_phone,
R.id.list_item_mobile_phone,
R.id.list_item_email,
R.id.list_item_picture
};
SimpleCursorAdapter records = new SimpleCursorAdapter(getBaseContext(), R.lay-
out.list_item, cursor, dataColumns, viewIDs, 0);
setListAdapter(records);
}
}
@Override
protected void onListItemClick(ListView l, View view, int position, long id) {
Uri details = Uri.withAppendedPath(StudentProvider.CONTENT_URI, "" + id);
Intent detailsIntent = new Intent(Intent.ACTION_VIEW, details);
startActivity(detailsIntent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
SearchManager searchManager = (SearchManager) getSystem-
Service(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView)
menu.findItem(R.id.menu_search).getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(get-
ComponentName()));
33
searchView.setIconifiedByDefault(false);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_search:
onSearchRequested();
return true;
default:
return false;
}
}
}
DETAILACTIVITY.JAVA
package com.saurabh.studentprofiles;
import java.io.IOException;
import java.io.InputStream;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
34
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
public class DetailActivity extends Activity implements OnClickListener {
public TextView mName;
public TextView rollno;
public TextView mDepartment;
public TextView fname;
private TextView mParentPhone;
private TextView mMobilePhone;
private TextView mSms;
private TextView mEmail;
private TextView psms;
private ImageView mPicture;
private int mID;
public Uri uri;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
getActionBar().setDisplayHomeAsUpEnabled(true);
35
}
Intent intent = getIntent();
Uri launchData = intent.getData();
mID = Integer.parseInt(launchData.getLastPathSegment());
uri = ContentUris.withAppendedId(StudentProvider.CONTENT_URI, mID);
mName = (TextView) findViewById(R.id.activity_detail_name);
rollno = (TextView) findViewById(R.id.activity_detail_title);
mDepartment = (TextView) findViewById(R.id.activity_detail_department);
fname = (TextView) findViewById(R.id.activity_detail_city);
mParentPhone = (TextView) findViewById(R.id.activity_detail_office_phone);
mMobilePhone = (TextView) findViewById(R.id.activity_detail_mobile_phone);
mSms = (TextView) findViewById(R.id.activity_detail_sms);
psms=(TextView)findViewById(R.id.activity_detail_parent_sms);
mEmail = (TextView) findViewById(R.id.activity_detail_email);
mPicture = (ImageView) findViewById(R.id.activity_detail_picture);
findViewById(R.id.activity_detail_call_office_button).setOnClickListener(this);
findViewById(R.id.activity_detail_office_phone).setOnClickListener(this);
findViewById(R.id.activity_detail_call_mobile_button).setOnClickListener(this);
findViewById(R.id.activity_detail_mobile_phone).setOnClickListener(this);
findViewById(R.id.activity_detail_send_sms_button).setOnClickListener(this);
findViewById(R.id.activity_detail_sms).setOnClickListener(this);
findViewById(R.id.activity_detail_send_parent_sms_button).setOnClick-
Listener(this);findViewById(R.id.activity_detail_parent_sms).setOnClick-
Listener(this);
findViewById(R.id.activity_detail_send_email_button).setOnClickListener(this);
findViewById(R.id.activity_detail_email).setOnClickListener(this);
PhoneCallListener phoneListener = new PhoneCallListener();
TelephonyManager telephonyManager = (TelephonyManager) this.getSystem-
Service(Context.TELEPHONY_SERVICE);
36
telephonyManager.listen(phoneListener, PhoneStateListener.LIS-
TEN_CALL_STATE);
new LoadEmployeesTask().execute();
}
private class LoadEmployeesTask extends AsyncTask<String, Void, Cursor> {
@Override
protected Cursor doInBackground(String... args) {
String[] projection = { StudentDatabase.COLUMN_ID, StudentDatabase.COL-
UMN_FIRSTNAME,StudentDatabase.COLUMN_LASTNAME, StudentData-
base.COLUMN_ROLL,StudentDatabase.COLUMN_DEPARTMENT, StudentData-
base.COLUMN_FNAME,StudentDatabase.COLUMN_PARENT_PHONE, Student-
Database.COLUMN_MOBILE_PHONE,StudentDatabase.COLUMN_EMAIL, Stu-
dentDatabase.COLUMN_PICTURE };
String selection = null;
String[] selectionArgs = null;
String sortOrder = null;
Cursor cursor = getContentResolver().query(uri, projection, selection, selectionArgs,
sortOrder);
return cursor;
}
@Override
protected void onPostExecute(Cursor cursor) {
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
mName.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUM
N_FIRSTNAME)));
mName.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUM
N_LASTNAME)));
rollno.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUMN_
ROLL)));
37
mDepartment.setText(cursor.getString(cursor.getColumnIndex(StudentData-
base.COLUMN_DEPARTMENT)));
fname.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUMN_
FNAME)));
mParentPhone.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.CO
LUMN_PARENT_PHONE)));
mMobilePhone.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.C
OLUMN_MOBILE_PHONE)));
mSms.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUMN_
MOBILE_PHONE)));
psms.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUMN_
PARENT_PHONE)));
mEmail.setText(cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUM
N_EMAIL)));
InputStream is;
try {
is = getAssets().open("pics/" +
cursor.getString(cursor.getColumnIndex(StudentDatabase.COLUMN_PICTURE)));
Bitmap bit = BitmapFactory.decodeStream(is);
mPicture.setImageBitmap(bit);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
38
inflater.inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
Intent parentActivityIntent = new Intent(this, MainActivity.class);
parentActivityIntent.addFlags(Intent.FLAG_ACTIV-
ITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(parentActivityIntent);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.activity_detail_call_office_button:
case R.id.activity_detail_office_phone:
case R.id.textView5: // clicking on textView will
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + mParentPhone.getText().toString()));
startActivity(Intent.createChooser(callIntent, "Choose an Call client :"));
break;
case R.id.activity_detail_call_mobile_button:
case R.id.activity_detail_mobile_phone:
case R.id.textView7:
Intent callIntent2 = new Intent(Intent.ACTION_CALL);
callIntent2.setData(Uri.parse("tel:" + mMobilePhone.getText().toString()));
startActivity(Intent.createChooser(callIntent2, "Choose an Call client :"));
39
break;
case R.id.activity_detail_send_sms_button:
case R.id.activity_detail_sms:
case R.id.textView9:
Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
smsIntent.setData(Uri.parse("smsto:" +
mMobilePhone.getText().toString()));
startActivity(Intent.createChooser(smsIntent, "Choose an
Sms client :"));
break;
case R.id.activity_detail_send_parent_sms_button:
case R.id.activity_detail_parent_sms:
case R.id.textView13:
Intent psmsIntent = new Intent(Intent.ACTION_SENDTO);
psmsIntent.setData(Uri.parse("smsto:" +
mMobilePhone.getText().toString()));
startActivity(Intent.createChooser(psmsIntent, "Choose an Sms client :)); break;
case R.id.activity_detail_send_email_button:
case R.id.activity_detail_email:
case R.id.textView11:
String to = mEmail.getText().toString();
String subject = "textSubject";
String message = "textMessage";
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.putExtra(Intent.EXTRA_TEXT, message);
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
break;
40
}
}
private class PhoneCallListener extends PhoneStateListener {
private boolean isPhoneCalling = false;
String LOG_TAG = LANGDON";
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (TelephonyManager.CALL_STATE_RINGING == state) {
Log.i(LOG_TAG, "RINGING, number: " + incomingNumber);
}
if (TelephonyManager.CALL_STATE_OFFHOOK == state) {
Log.i(LOG_TAG, "OFFHOOK");
isPhoneCalling = true;
}
if (TelephonyManager.CALL_STATE_IDLE == state) {
Log.i(LOG_TAG, "IDLE");
if (isPhoneCalling) {
Log.i(LOG_TAG, "restart app");
Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage(
getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
isPhoneCalling = false;
}
}
}
}
}
STUDENTXMLPARSER.JAVA
package com.saurabh.studentprofiles;
41
import android.content.Context;
import android.view.MenuItem;
import android.widget.Button;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
STUDENTDATABASE.JAVA
package com.saurabh.studentprofiles;
44
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
public class StudentDatabase extends SQLiteOpenHelper {
private Context context;
ArrayList<Student> studentList = new ArrayList<Student>();
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "student_directory";
public static final String TABLE_STUDENTS = "students";
public static final String COLUMN_ID = "_id";
public static final String COLUMN_FIRSTNAME = "first_name";
public static final String COLUMN_LASTNAME = "last_name";
public static final String COLUMN_ROLL = "rollno";
public static final String COLUMN_DEPARTMENT = "department";
public static final String COLUMN_FNAME = "fathername";
public static final String COLUMN_PARENT_PHONE = "parent_phone";
public static final String COLUMN_MOBILE_PHONE = "mobile_phone";
public static final String COLUMN_EMAIL = "email";
public static final String COLUMN_PICTURE = "picture";
}
}
StudentProvider.java
package com.saurabh.studentprofiles;
47
import android.app.SearchManager;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import java.util.HashMap;
48
private static final HashMap<String, String> SEARCH_SUGGEST_PROJEC-
TION_MAP;
static {
SEARCH_SUGGEST_PROJECTION_MAP = new HashMap<String,
String>();
SEARCH_SUGGEST_PROJECTION_MAP.put(StudentData-
base.COLUMN_ID, StudentDatabase.COLUMN_ID);
SEARCH_SUGGEST_PROJECTION_MAP.put(SearchManager.SUG-
GEST_COLUMN_TEXT_1, StudentDatabase.COLUMN_FIRSTNAME + " AS " +
SearchManager.SUGGEST_COLUMN_TEXT_1);
SEARCH_SUGGEST_PROJECTION_MAP.put(SearchManager.SUG-
GEST_COLUMN_TEXT_2, StudentDatabase.COLUMN_LASTNAME + " AS " +
SearchManager.SUGGEST_COLUMN_TEXT_2);
SEARCH_SUGGEST_PROJECTION_MAP.put(SearchManager.SUG-
GEST_COLUMN_INTENT_DATA_ID, StudentDatabase.COLUMN_ID + " AS " +
SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID);
}
public StudentProvider() {
mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
mUriMatcher.addURI(AUTHORITY, StudentDatabase.TABLE_STU-
DENTS, STUDENTS);
mUriMatcher.addURI(AUTHORITY, StudentDatabase.TABLE_STU-
DENTS + "/#", STUDENTS_ID);
mUriMatcher.addURI(AUTHORITY, SearchManager.SUG-
GEST_URI_PATH_QUERY, SEARCH_SUGGEST);
mUriMatcher.addURI(AUTHORITY, SearchManager.SUG-
GEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);
}
@Override
49
public boolean onCreate() {
mStudentDatabase = new StudentDatabase(getContext());
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] se-
lectionArgs, String sortOrder) {
STUDENT.JAVA
package com.saurabh.studentprofiles;
51
public class Student {
Integer _stuID;
String _firstName;
String _lastName;
String _rollno;
String _department;
String _fname;
String _parentPhone;
String _mobilePhone;
String _email;
String _picture;
public Student(Integer empID, String firstName, String lastName, String title,
String department, String city, String officePhone, String mobilePhone, String email,
String picture) {
this._stuID = empID;
this._firstName = firstName;
this._lastName = lastName;
this._rollno = title;
this._department = department;
this._fname = city;
this._parentPhone = officePhone;
this._mobilePhone = mobilePhone;
this._email = email;
this._picture = picture;
}
public void setId(Integer empID) {
this._stuID = empID;
}
public void setFirstName(String firstName) {
this._firstName = firstName;
52
}
public void setLastName(String lastName) {
this._lastName = lastName;
}
public void setTitle(String title) {
this._rollno = title;
}
public void setDepartment(String department) {
this._department = department;
}
public void setCity(String city) {
this._fname = city;
}
public void setOfficePhone(String officePhone) {
this._parentPhone = officePhone;
}
public void setMobilePhone(String mobilePhone) {
this._mobilePhone = mobilePhone;
}
public void setEmail(String email) {
this._email = email;
}
public void setPicture(String picture) {
this._picture = picture;
}
public Integer getId() {
return this._stuID;
}
public String getFirstName() {
return this._firstName;
53
}
public String getLastName() {
return this._lastName;
}
public String getTitle() {
return this._rollno;
}
public String getDepartment() {
return this._department;
}
public String getCity() {
return this._fname;
}
public String getOfficePhone() {
return this._parentPhone;
}
public String getMobilePhone() {
return this._mobilePhone;
}
public String getPicture() {
return this._picture;
}
@Override
public String toString() {
return _firstName + " " + _lastName + "\n" + _rollno;
}
}
SEARCHABLEACTIVITY.JAVA
package com.saurabh.studentprofiles;
54
import android.annotation.TargetApi;
import android.app.ListActivity;
import android.app.SearchManager;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
57
SRC 1: STUDENTS DETAILS IN LIST
VIEW
58
SRC 4 : MESSAGING OPTIONS
59
CHAPTER 6
TESTING
60
6.1 INTRODUCTION
In general, testing is finding out how well something works. In terms of human
beings, testing tells what level of knowledge or skill has been acquired. In computer
hardware and software development, testing is used at key checkpoints in the overall
process to determine whether objectives are being met. For example, in software de-
velopment, product objectives are sometimes tested by product user representatives.
When the design is complete, coding follows and the finished code is then tested at the
unit or module level by each programmer; at the component level by the group of pro-
grammers involved; and at the system level when all components are combined to-
gether. At early or late stages, a product or service may also be tested for usability.
61
UNIT TESTING : Unit testing is a software development process in which the
smallest testable parts of anapplication, called units, are individually and independently
scrutinized for proper operation. Unit testing is often automated but it can also be done
manually. This testing mode is a component of Extreme Programming (XP), a prag-
matic method of software development that takes a meticulous approach to building a
product by means of continual testing and revision.
Unit testing involves only those characteristics that are vital to the performance of the
unit under test. This encourages developers to modify the source code without imme-
diate concerns about how such changes might affect the functioning of other units or
the program as a whole.
Test Case 1
Test case 1: Home page Priority (H, L): High
Test Setup/Pre-Conditions:
62
Actions Expected Results
Test Case 2
Test case 2:Communication Details on click Priority (H, L): High
Test Setup/Pre-Conditions:
63
Test Case 3
Test case 3: Application functions working Priority (H, L): High
Test Setup/Pre-Conditions:
7.CONCLUSION
This application is built in Android Studio using its SDK tools .This application can
be used by the staff to communicate with the students and their parents as and when
its required without wasting any time. All the details related to a particular student
64
are displayed and directly phone calls,messages or mails can be made from this appli-
cation to any particular individual.Thus the communication between the faculty , stu-
dents and their parents is enhanced.
8. FUTURE SCOPE
This project can be modified in future in order to maintain all the student related in-
formation of the entire college in a single application.Several other changes like in-
ternet messaging and internet calling are also possible to be added.It has all the fea-
tures to become a substitute for the most commonly used inbuilt phone directory.Ease
of use , no chance of loss of data and less maintenance cost makes it a highly desired
application for the users.Apart from the application part android widget for the appli-
cation can also be created which would provide a much faster access to a particular
individuals information instead of searching for a particular person.
65
66