You are on page 1of 44

ASSIGNMENT MASTER An Android App.

A PROJECT REPORT

Submitted by

SANDEEP SHARMA VIPUL DAWAR PRATIK BAGARIA


in partial fulfillment for the minor project of

BACHELOR OF TECHNOLOGY
in Computer Science Engineering

Maharaja Agrasen Institute of Technology, PSP Area Sector-22, Rohini, New Delhi-110085

GGSIP UNIVERSITY NEW DELHI


1

GGSIPU
BONAFIDE CERTIFICATE

Certificate
This is to certify that report entitled ASSIGNMENT MASTER which is submitted by Sandeep Sharma (1161482708), Vipul Dawar (1211482708) and Pratik Bagaria (1231482708) in partial fulfillment of the requirement for the award of degree B.Tech in Computer Science & Engineering to GGSIP University, Kashmere Gate, Delhi is a record of the candidate own work carried out by them under my supervision. The matter embodied in this thesis is original and has not been submitted for the award of any other degree.

SIGNATURE Prof. Suresh Chander HEAD OF THE DEPARTMENT

SIGNATURE Mr. Saurabh Rastogi GUIDE NMAE (Assistant Professor)

Department of Computer Science

Department of Computer Science

Maharaja Agrasen Institute of Technology Sector -22 , Rohini Delhi

Maharaja Agrasen Institute of Technology Sector -22 , Rohini Delhi

DECLARATION
This is to certify that Thesis/Report entitled ASSIGNMENT MASTERwhich is submitted by me in partical fulfillment of the requirement for the award of degree B.Tech. in Computer science & Engineering to GGSIP University, Kashmere Gate, Delhi comprises only my original work and due acknowledgement has been made in the text to all other material used and to my respective guide.

Date: (1161482708)

Sandeep Sharma Vipul Dawar

(1211482708) Pratik Bagaria (1231482708)

SIGNATURE Prof. Suresh Chander HEAD OF THE DEPARTMENT Department of Computer Science Maharaja Agrasen Institute of Technology 3

SIGNATURE Mr. Saurabh Rastogi GUIDE NMAE (Assistant Professor) Department of Computer Science Maharaja Agrasen Institute of Technology

Sector -22 , Rohini Delhi

Sector -22 , Rohini Delhi

TABLE OF CONTENTS

CHAPTER NO.

TITLE ABSTRACT LIST OF FIGURES LIST OF ABBREVIATIONS

PAGE NO. 7 8 9

1.

INTRODUCTION 1.1 OVERVIEW OF ANDROID 1.1.1 Android Architecture 1.1.2 Application Framework 1.1.3 Android Runtime 1.2 The Dalvik Virtual Machine 1.3 Development Tools 11 12 13

10 11

15 15

2.

PROBLEM DEFINITION

17

3.

HARDWARE REQUIREMENTS

18

4.

SOFTWARE REQUIREMENTS 4.1 Java Development Kit 1.6 (JDK 1.6) 4.2 Eclipse IDE 4

19 19 20

5.

PROJECT MODULES 5.1 MODULE 1 5.2 MODULE 2 5.3 MODULE 3 5.3.1 SQLiteOpenHelper 5.3.2 Inserting data into the database 5.3.3 Updating data in the database 5.3.4 Deleting data from the database

21 22 24 26 26 27 27 27

6.

PROJECT OUTPUT 6.1 Assignment Master Starts First time with NO TASKS ADDED 6.2 Adding Assignment and Tasks to ASSIGNMENT MASTER 6.3 Writing ASSIGNMENT in Textbox 6.4 Press ADD TASK to add assignment to view list. 6.5 TASK added to view list. 6.6 Safe Cancelling. 6.7 Safe Cancelling Prompt. 6.8 Many Tasks added with few Completed Task marked by Tick Mark and using scroll bar to manage many Tasks. 6.9 Removing Completed Task. 6.10 View list state after removing completed task left with uncompleted tasks. 6.11 Press STOP in DDMS to kill Assignment Master. 6.12 Restarting the ASSIGNMENT MASTER APPLICATION. 6.13 Tasks are consistent in Application as left before kill process, shows Tasks are stored and retrieved in SQLite Database . 34 32 30

29 29 29 30 30 31 31

33 33 33 34

7.

CONCLUSION AND FUTURE WORK APPENDIX 1 5

36

Android components

37

APPENDIX 2 Environment Installations and Emulator Set up APPENDIX 3 Emulator set up REFERENCES 41 44 38

ABSTRACT

One of the important drivers in getting things done is to have a good list manager or what we call in common terms, Assignment Master. The role of this manager is as a repository for the activities that you want to do and probably check it off once done. Assignment Master need not be on a computer. In fact, you can use your Mobile Phone as a Assignment Master and it works as well as any hi-tech gadget.

If someone wants to remember some activities to get it done at a later point of time, then one has two choices. One, write it down on a piece of paper (or in a computer) or keep it in your mind. If you decide to use the latter, the chances of you remembering the task depends on certain chemical compositions in your mind.

One needs a place where the activities can be written down or keyed in. It should be on a reliable substrate that can be depended upon. Keeping activities listed on a Gadgets (Mobile)is perhaps the most popular and the simplest way to manage.

LIST OF FIGURES

FIGURE NO. 1.1 1.2 1.3 5.1 5.2 5.3 5.4 6.1,2..13

FIGURE NAME Architecture of Android OS Conversion from .java to .dex file Android Execution Environment View Layout Add TASK View Safe Cancelling Add List View Project Output Figures

PAGE 12 14 14 23 23 24 25 41

LIST OF ABBREVIATIONS S.NO 1 2 3 4 5 6 7 8 9 10 ABBREVATION SDK API AWT JVM JDK JRE DDMS IDE DBMS SQL EXPANSION Software Development Kit Application Program Interface Abstract Window Toolkit Java Virtual Machine Java Development Kit Java Runtime Environment Dalvik Debug Monitor Service Integrated Development Environment Data Base Management System Structured Query Language

CHAPTER 1 INTRODUCTION
Assignment Master is an Android Application for Android Mobile Devices which could cater the needs of the users to maintain a note of their Tasks to be accomplished. . The role of this manager is as a repository for the activities that you want to do and probably check it off once done. The Assignment Master is a to-do list app for Android. It has an easy user interface that allows users to view tasks, edit existing tasks, and add new things to do. As you complete an item on the list, simply check it off and continue on to the next one. The Assignment Master was developed by using Java Programming Language over the Android Framework including features like:

Dalvik virtual machine optimized for mobile devices SQLite : - a powerful and lightweight relational database engine is available to the applications Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

10

1.1 OVERVIEW OF ANDROID Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android is a software platform and operating system for mobile devices based on the Linux operating system and developed by Google and the Open Handset Alliance. It allows developers to write managed code in a Java-like language that utilizes Google-developed Java libraries, but does not support programs developed in native code. The unveiling of the Android platform on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of 34 hardware, software and telecom companies devoted to advancing open standards for mobile devices. When released in 2008, most of the Android platform will be made available under the Apache free-software and open-source license. 1.1.1 Android Architecture The following diagram shows the major components of Android

11

Figure 1.1: Architecture of Android OS

1.1.3 Application Framework Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user. Underlying all applications is a set of services and systems, including: A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser
12

Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data A Resource Manager, providing access to non-code resources such as localized strings, graphics, and lat files A Notification Manager that enables all applications to display custom alerts in the status bar An Activity Manager that manages the life cycle of applications and provides a common navigation backstack

1.1.4 Android Runtime Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management. At the same level there is Android Runtime, where the main component Dalvik Virtual Machine is located. It was designed specifically for Android running in limited environment, where the limited battery, CPU, memory and data storage are the main issues. Android gives an integrated tool dx, which converts generated byte code from .jar to .dex file, after this byte code becomes much more efficient to run on the small processors.
13

Figure 1.2: Conversion from .java to .dex file As the result, it is possible to have multiple instances of Dalvik virtual machine running on the single device at the same time. The Core libraries are written in Java language and contains of the collection classes, the utilities, IO and other tools.

Figure 1.3: Android Execution Environment


14

1.2 The Dalvik Virtual Machine The Dalvik virtual machine is an interpreter only machine optimized for use on low powered, low memory devices like phones. Notably, Dalvik does not make use of just in time (JIT) Compilation to improve the performance of an application at runtime. Furthermore, Dalvik is not a Java virtual machine. This is because Dalvik is unable to read Java bytecode34, instead it uses its own bytecode format called dex. Google claims this format allows battery power to be better-conserved at all different stages of execution of an application. This means that standard Java SE applications and libraries cannot be used directly on the Android Dalvik virtual machine. Dalvik however stands at the center of the Android value proposition. Its low electrical power consumption, rich libraries, and unified, non-fragmented application programming interfaces make it stand out, or so Google hopes, over the fragmented ecosystem that is Java ME35 today. Furthermore, since Dalvik uses the Java programming language but not the Java execution environment (JVM), Google is free to develop Android without the need to license or obtain certification from Sun Microsystems Inc, the legal owner of the Java trademark and brands. 1.3 Development Tools The Android SDK includes a variety of custom tools that help develop mobile applications on the Android platform. The most important of these are the Android Emulator and the Android Development Tools plugin for Eclipse, but the SDK also includes a variety of other tools for debugging, packaging, and installing applications on the emulator.

15

Android Emulator A virtual mobile device that runs on computer use the emulator to design, debug, and test applications in an actual Android run-time environment. Android Development Tools Plugin for the Eclipse IDE The ADT plugin adds powerful extensions to the Eclipse integrated environment, making creating and debugging Android applications easier and faster. If we use Eclipse, the ADT plugin gives applications: It gives access to other Android development tools from inside the Eclipse IDE. For example, ADT lets access the many capabilities of the DDMS tool taking screenshots, managing port-forwarding, setting breakpoints, and viewing thread and process information directly from Eclipse. It provides a New Project Wizard, which helps quickly create and set up all of the basic filesll need for a new Android application. It automates and simplifies the process of building Android application. It provides an Android code editor that helps write valid XML for Android manifest and resource files. Dalvik Debug Monitor Service (ddms) Integrated with Dalvik, the Android platform's custom VM, this tool lets manage processes on an emulator or device and assists in debugging. We can use it to kill processes, select a specific process to debug, generate trace data, view heap and thread information, take screenshots of the emulator or device, and more. an incredible boost in developing Android

16

CHAPTER 2
PROBLEM DEFINITION
We are required to build an android mobile application which will manage the Task of user.You can add, edit or delete any task, from the app,which are saved in the SD Memory Card. The Persistence is achieved through SQLite Database. It implements different views and Activities for each and every implementation. The Tasks can be marked as completed and later can be deleted based on completion. The Application can be saved in the Memory Card of your mobile device and can be test on emulators.

17

CHAPTER 3 HARDWARE REQUIREMENTS


This application will run on devices with following specifications:

OS: Android OS, v1.6 (Donut), upgradable Processor: 528 MHz ARM 11 processor, Adreno 130 GPU, Qualcomm MSM7201A chipset

Memory: internal: 192 MB RAM, 256 MB ROM Card Slot: MicroSD

18

CHAPTER 4 SOFTWARE REQUIREMENTS


4.1 Java Development Kit 1.6 (JDK 1.6)
The JDK is a development environment for building applications, applets, and components using the Java programming language.The JDK includes tools useful for developing and testing programs written in the Java programming language and running on the Java platform. JDK contents The JDK has as its primary components a collection of programming tools, including:

java the loader for Java applications. This tool is an interpreter and can interpret the class files generated by the javac compiler. Now a single launcher is used for both development and deployment. The old deployment launcher, jre, no longer comes with Sun JDK, and instead it has been replaced by this new java loader. javac the compiler, which converts source code into Java bytecode appletviewer this tool can be used to run and debug Java applets without a web browser javadoc the documentation generator, which automatically generates documentation from source codecomments jar the archiver, which packages related class libraries into a single JAR file. This tool also helps manage JAR files.

The JDK also comes with a complete Java Runtime Environment, usually called a private runtime, due to the fact that it is separated from the "regular" JRE and has
19

extra contents. It consists of a Java Virtual Machine and all of the class libraries present in the production environment, as well as additional libraries only useful to developers. 4.2.1 Eclipse IDE Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-insystem. It is written mostly in Java and can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy and Scheme. It can also be used to develop packages for the software Mathematica. The IDE is often called Eclipse ADT (Ada Development Toolkit) for Ada, Eclipse CDT for C/C++, Eclipse JDT for Java, and Eclipse PDT for PHP. The initial codebase originated from VisualAge.[1] In its default form it is meant for Java developers, consisting of the Java Development Tools (JDT). Users can extend its abilities by installing plug-ins written for the Eclipse software framework, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules.

20

CHAPTER 5
PROJECT MODULES
Module 1: Build Assignment Manager App. Layout and Build a Add Task Activity. Displaying a list of tasks. Implement Safe Cancelling. Module 2: Create a Task List. Creating a List of Tasks. Showing the Tasks. Completing Tasks. Removing Completed Tasks. Module 3: Adding Persistence. Adding Persistence to our Application using SQLite. Adding and loading of tasks to and from the database. Removing Completed tasks from Database.

21

5.1 MODULE 1 Layouts Module -1 briefly explains about the different types of layouts i.e Linear Layout and Relative Layout. The major pain point in using Relative layout is that, the controls should be specified in the order in which they are referenced and not in the order in which they will be displayed. EditText control EditText control is an editable control which can be used to get user input. It is similar to the HTML textbox or the Java Swing JTextField. Sharing data between views An application can have multiple activities (views) and to share data between these multiple activities, the android framework provides a class called Application. This Application class can be accessed from all the activities of the app by calling the getApplication() of the Activity class.

22

Figure 5.1:View Layout

Figure 5.2:Add TASK View

23

Safe cancelling This explains about how to listen to text changes and make sure the user is not moving away from the activity when there are unsaved work.You can check the cancel() method in addTaskActivity class, where we will be showing an alert box (see screenshot) using the built in AlertDialog, whenever the user clicks the cancel button without saving the task that he has entered. Figure 5.3:Safe Cancelling

5.2 MODULE 2 ListView and ListAdapter ListView is a control which can be used for creating list of scrollable items. The data to the ListView will be provided by ListAdapter.You can think of ListView as the view component in a MVC framework and ListAdapter as the model The class which is going to act as the ListAdapater should implement following methods

getCount() getItem() getItemId() getView()

24

Adding ListView To add ListView to any activity, we have to include the <ListView /> tag to the activitys layout xml.The Activity class that uses ListView should implement the ListActivity instead of plain Activityclass. The ViewTasksActivity class is derived from the ListActivity class. Magic ids Android SDK provides some predefined ids which can be used some specific purposes. One such magic id is android: empty.We can assign this to any element that we want to be displayed when the List View is empty.

Figure 5.4:Add List View


25

5.3 MODULE 3 Android has a bundled SQLite database and your app can store and retrieve information by creating a new database. The database that is created by an application is available only to that application and no other application can access it. 5.3.1 SQLiteOpenHelper Android SDK provides a class called SQLiteOpenHelper which can be used for interfacing with this SQLite database that is associated with your application. SQLiteOpenHelper has two methods which can be used for creating/updating the database. They are the following. onCreate The onCreate() method gets called when the app gets installed for the first time. The SQL code to create the database should go in this method. In addition to the SQL code we should also specify a version number for the database which will be used subsequently during upgrades. onUpgrade The onUpgrade() method gets called when the app is upgraded or if the version number specified in the app is greater than the one which is present in the database. Typically this function contains Alter table SQL code which will be used to upgrade the database.In addition to the above two methods, the SQLiteOpenHelper

26

also has other methods which can be used to access the database. One such method is getWritableDatabase() getWritableDatabase The getWritableDatabase() method will return a SQLiteDatabase object which has reference to the database.In addition to these methods, the SQLiteOpenHelper class other methods but the above there are the notable ones. To selected data from the database, we have to call the query() method on the SQLiteDatabase object which is returned by the getWritableDatabase() method above.The query() method returns an object of type Cursor, which can be iterated over to retrieve the resultset. 5.3.2 Inserting data into the database In order to insert the data into the database we have to call the insert() method of the SQLiteDatabase. The data that needs to be inserted should be added to a ContextValues object and then passed to the insert() method. The ContextValues object is like a HashMap which contains the key and the value for each column of the row that will be inserted. insert() method returns the id of the row that was inserted. 5.3.3 Updating data in the database To update data in the database we have to call the update() method of the SQLiteDatabase object. Like the insert() method, the data that needs to be updated should be passed in a ContextValues object.

27

5.3.4 Deleting data from the database To delete data from the database we have to call the delete() method of the SQLiteDatabase objet. The delete() method takes the where condition based on which the rows will be deleted.

28

CHAPTER 6 PROJECT OUTPUT


6.1 Assignment Master Starts First time with NO TASKS ADDED

Figure 6.1: 6.2 Adding Assignment and Tasks to ASSIGNMENT MASTER

Figure 6.2 29

6.3 Writing ASSIGNMENT in TextBOX

Figure 6.3

6.4 Press ADD TASK to add assignment to view list.

Figure 6.4 30

6.5 TASK added to view list.

Figure 6.5 6.6 Safe Cancelling.

Figure 6.6

31

6.7 Safe Cancelling Prompt.

Figure 6.7 6.8 Many Tasks added with few Completed Task marked by Tick Mark and using scroll bar to manage many Tasks.

Figure 6.8 32

6.9 Removing Completed Task.

Figure 6.9 6.10 View list state after removing completed task left with uncompleted tasks.

Figure 6.10 33

6.11 Press STOP in DDMS to kill Assignment Master.

Figure 6.11

6.12 Restarting the ASSIGNMENT MASTER APPLICATION.

Figure 6.12

34

6.13 Tasks are consistent in Application as left before kill process, shows Tasks are stored and retrieved in SQLite Database .

Figure 6.13

35

CHAPTER 7 CONCLUSION AND FUTURE WORK


CONCLUSION
An approach is designed to save all the Assignments and Tasks of the users to a medium which is high tech (gadgets) that is equally easy to interact and manage. With ease portability of mobile phones, every person can use the app. The manager is as a repository for the activities that you want to do and probably check it off once done. The Application is portable to any Android Platform Above 1.6, with ease of installation and operation. The Application at same time is GUI based and cost effective. FUTURE WORK Some of the future enhancement works that we focus at are: Adding Location and Maps.

Adding a Location to a Task.

Displaying a Map View. Searching for an Address on the Map. Adding Location Awareness.

Displaying the Location of the Task. Adding the Device's Current Location to the Map. Displaying the Current Location on the Task List. Filtering the Tasks by Location.
36

APPENDIX-1
< Android components>

Android components
An Android application consists out of the following parts:

Activity - represents the presentation layer of an Android application, e.g. a screen which the user sees. An Android application can have several activities and it can be switched between them during runtime of the application. Views - the User interface of Activities is built with widget classes which inherent fromandroid.view.View. The layout of the views is managed by android.view.ViewGroups. Views often have attributes which can be used to change their appearance and behavior. Services - perform background tasks without providing an UI. They can notify the user via the notification framework in Android. ContentProvider - provides data to applications, via a content provider your application can share data with other applications. Android contains a SQLite DB which can serve as data provider Intents - are asynchronous messages which allow the application to request functionality from other services or activities. An application can call directly a service or activity (explicit intent) or ask the Android system for registered services and applications for an intent (implicit intents). BroadcastReceiver - receives system messages and implicit intents, can be used to react to changed conditions in the system. An application can register as a BroadcastReceiver for certain events and can be started if such an event occurs. Widgets - interactive components primary used on the Android homescreen to display certain data and to allow the user to have quick access the information.

.
37

APPENDIX-2
< Environment Installations and Emulator Set up >
.

2.1. Eclipse and automatic Android SDK Use the Eclipse update manager to install all available components for the Android Development Tools (ADT) from the URL https://dlssl.google.com/android/eclipse/[7]. After the new Android development components are installed you will be prompted to install the Android SDK. You can do follow the following wizard or go to the next section to learn how to do it manually.

38

39

2.2. Manually install Android SDK The previous step downloads the Android SDK automatically for you. You can also download the Android SDK manually from the Android homepage under Android SDK download. The download contains a zip file which you can extract to any place in your file system, e.g. I placed it under "c:\android-sdkwindows". Avoid using spaces in the path name otherwise you may experience problems later. You also have to define the location of the Android SDK in the Eclipse Preferences. In Eclipse open the Preferences dialog via Windows Preferences . Select Android and enter the installation path of the Android SDK.

40

2.3. Install a specific Android version The Android SDK Manager allows you to install specific versions of Android. Select Window Android SDK Manager from the Eclipse menu.

The dialog allows you to install new package and also allow you to delete them. Select "Available packages" and open the "Third Party Add-ons".

Press the "Install" button and confirm the license for all package. After the installation restart Eclipse.
41

APPENDIX-3
< Emulator set up > 3. Emulator Shortcuts 3.1. Create an Android Emulator Device The Android tools include an emulator. This emulator behaves like a real Android device in most cases and allows you to test your application without having a real device. You can emulate one or several devices with different configurations. Each configuration is defined via an "Android Virtual Device" (AVD). To define an AVD open the "AVD Manager" via Windows AVD Manager and press "New".

42

Enter the following.

We can also select the box "Enabled" for Snapshots. This will make the second start of the virtual device much faster. At the end press the button "Create AVD".This will create the device and display it under the "Virtual devices". To test if your setup is correct, select your device and press "Start". After (a long time) your device should be started. 3.2. Using the emulator Obviously you can use the emulator via the keyboard on the right side of the emulator. But there are also some nice shortcuts which are useful. Alt+Enter maximizes the emulator. Nice for demos.Ctrl+F11 changes the orientation of the emulator.F8 turns network on / off.
43

REFERENCES [1] [2] [3] [4] [5] [6] [7] http://developer.android.com/ - Android Developers official webpage http://www.openhandsetalliance.com/ - Open Handset Alliance webpage http://code.google.com/android/ - Google Android official webpage http://www.openhandsetalliance.com/ - Open Handset Alliance webpage http://googleblog.blogspot.com/ - Official Google Blog https://dl-ssl.google.com/android/eclipse/ - Android sdk download. http://www.vogella.de/articles/Android/article.html - Environment Setup

44

You might also like