You are on page 1of 36

A PROJECT REPORT ON

ANDROID APPLICATION (NOTICE BOARD) Submitted to Amity University Uttar Pradesh

in partial fulfillment of the requirements for the award of the Degree of Bachelor of Technology in INFORMATION TECHNOLOGY By VINAY KUMAR SINGH ATUL YADAV ATUL GARG ASHISH KALRA (8IT-3) under the guidance of Ms. Promila Bahadur Department of Information Technology Amity School of Engineering and Technology AMITY UNIVERSITY UTTAR PRADESH NOIDA (U.P.)
APRIL 2012

A2305308215 A2305308199 A2305308189 A2305308192

DECLARATION
We Vinay Singh, Atul Yadav, Ashish Kalra and Atul Garg student of B. Tech (I.T.) hereby declare the project titled ANDROID APPLICATION (NOTICE BOARD) which is submitted by us to Department of Information Technology, Amity School of Engineering and Technology, Amity University, Uttar Pradesh, Noida, in partial fulfillment of requirements for the award of degree of Bachelor in Technology in Information Technology, has not been previously formed the basis for the award of any degree, diploma or other similar title or recognition.

Noida Date: 29-03-2012 Vinay Singh A2305308215 Atul Yadav A2305308199 Ashish Kalra A2305308192 Atul Garg A2305308189

CERTIFICATE
On the basis of declaration submitted by Vinay Singh, Atul Yadav, Ashish Kalra and Atul Garg student of B. Tech (I.T.). We hereby certify that the project titled ANDROID APPLICATION (NOTICE BOARD), which is submitted to Department of Information Technology, Amity School of Engineering and Technology, Amity University, Noida, Uttar Pradesh, in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Information Technology, is an original contribution with an existing knowledge and faithful record of work carried out by them under my guidance and supervision. To the best of our knowledge this work has not been submitted in part or full for any degree or diploma in this University or elsewhere.

Noida Date: 29-03-2012 Ms. Promila Bahadur Department of Information Technology Amity School of Engineering and Technology Amity University, Uttar Pradesh

ACKNOWLEDGEMENT

We would like to sincerely thank my faculty guide, Ms. Promila Bahadur for taking all possible pains to go through my project to make necessary changes as and when needed. They both were always there whenever I felt need of their guidance and support. Our deepest and sincere thanks to my guide at , Prof.(Dr.) Balwinder Shukla for giving me such a great opportunity to do research at such a prestigious university and exposure to this incredible project. We would also like to thank my institution and all other faculty members without whom this project might have been a distant realty.

Vinay Singh A2305308215 Atul Yadav A2305308199 Ashish Kalra A2305308192 Atul Garg A2305308189

Abstract
Android Internet Applications allow mobile users to connect to the World Wide Web or to access the web pages from their mobile device. These days everyone seems to be connected with the world using wireless devices and amazingly mobile phone is the most commonly used wireless device. Android SDK provides immense opportunities and flexibility for programmers to develop higher-end internet applications for Android based devices. Android Internet Applications (or Android Web Applications) can include a wide varietysuch as applications that help to connect to the internet for playing online games such as chess etc., applications that connect to the internet to find information for unknown calls, applications that help to import internet explorer, firefox and chrome bookmarks to the android browser and so on (the list is endless). Android Mobile Development has extensive experience & expertise in developing mobile applications from simple to complex. We have invested heavily in our infrastructure and developing in-house team of mobile application developers. And above all a commitment to deliver economical & professional services to our clients irrespective of their size and location. All this makes us a perfect choice for our clients to outsource mobile applications development including Android Internet Applications development to us.

CONTENTS TABLE

S.No.

Contents Introduction

Page No. 8 8 9 9 9 11 11 11 11 12 12 12 12 12 13 15 15 15 15 17 17 17 18 18 18 19 20 20 20 20 21 26 26 26 27 27 7 27

1.0 1.1 2.0 2.1 2.2 3.0 3,1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 5.0 5.1 5.2 5.3 5.4 5.5 5.6 6.0 6.1 6.2 6.3 6.4 7.0 7.1 7.2 7.3 7.4 7.5

Android Operating System Literature Review Android Operating System Security and Permission Android Components Activity Views and Viewgroups Intents Services Content Provider Broadcast Receiver (Home screen) Widgets Other Compound Controls Android Development Tools7 What are Android Development Tools? Dalvik Virtual Machines How to develop Android Application? Android Application Architecture Android Manifest.xml R.java and Resources Assets Reference to Resources in xml files Activities and Layouts Activities and Lifecycle Installation Pre Requisites for using a 64-bit Linux Eclipse and Automatic Android SDK Manually install Android SDK Install a Specific Android Version Android Virtual Device Emulator What is Android Emulator? Goole vs Android AVD Emulator Shortcuts Performance Hardware Button

CHAPTER 1 INTRODUCTION

1.1 Android Operation System Android is an operating system based on Linux with a Java programming interface. The Android Software Development Kit (Android SDK) provides all necessary tools to develop Android applications. This includes a compiler, debugger and a device emulator, as well as its own virtual machine to run Android programs. Android is currently primary developed by Google. Android allows background processing, provides a rich user interface library, supports 2-D and 3-D graphics using the OpenGL libraries, access to the file system and provides an embedded SQLite database.

Android applications consists out of different components and can re-use components of other applications if these applications declare their components as available. This leads to the concept of a task in Android, an application can re-use other Android components to archive a task. For example you can write an Application which integrates the map component and a camera component to archive a certain task.

CHAPTER 2 LITERATURE REVIEW


2.1. Android Operation System
Android is an operating system based on Linux with a Java programming interface. The Android Software Development Kit (Android SDK) provides all necessary tools to develop Android applications. This includes a compiler, debugger and a device emulator, as well as its own virtual machine to run Android programs. Android is currently primary developed by Google. Android allows background processing, provides a rich user interface library, supports 2-D and 3-D graphics using the OpenGL libraries, access to the file system and provides an embedded SQLite database.

Android applications consists out of different components and can re-use components of other applications if these applications declare their components as available. This leads to the concept of a task in Android, an application can re-use other Android components to archive a task. For example you can write an Application which integrates the a map component and a camera component to archive a certain task.

2.2. Security and permissions


During deployment on an Android device, the Android system will create a unique user and group ID for every Android application. Each application file is private to this generated user, e.g. other applications cannot access these files. In addition each Android application will be started in its own process. Therefore by means of the underlying Linux operating system, every Android application is isolated from other running applications. A misbehaving application cannot easily harm other Android applications. If data should be shared the application must do this explicitly, e.g. via a Service or a Content
Provider.

Android also contains a permission system. Android predefines permissions for certain tasks but every application can also define its own permissions. An application must declare in its configuration file (AndroidManifest.xml) that it requires certain permissions. Depending on the details of the defined permission, the Android system will during installation automatically grant the permission, reject it or ask the user if he grants these permissions to the application.

10

If for example the application declares that is requires Internet access then the user need to confirm this during installation. This is called "user driven security". The user decides to grant permission or to deny it. If the user does not want to give all permissions required by the application, this application cannot be installed. The check of the permission is only performed during installation; permissions cannot be denied or granted after the installation. Typically not all users check the permissions in detail but some users do and if there is something strange with them, they will write bad reviews on the corresponding Android markets.

CHAPTER 3 ANDROID COMPONENTS

3.1. Activity
Activity

represents the presentation layer of an Android application. A simplified (and can be displayed as dialogs or transparent. An Android application can have

slightly incorrect) description is that an Activity is a screen. This is slightly incorrect as


Activities

several Activities.

3.2. Views and ViewGroups


Views

are user interface widgets, e.g. buttons or text fields. The base class for all Views is often have attributes which can be used to change their appearance

android.view.View. Views

and behavior.

11

A ViewGroup is responsible for arranging other Views e.g. they are layout manager. The base class for a layout manager is android.view.ViewGroups. ViewGroup also extends View.
ViewGroups

can be nestled to create complex layouts. You should not nestle ViewGroups too

deeply as this has a negative impact on performance.

3.3. Intents
Intents

are asynchronous messages which allow the application to request functionality from

other components of the Android system, e.g. from Services or Activities. An application can call a component directly (explicit intent) or ask the Android system to evaluate registered components for a certain Intents (implicit intents). For example the application could implement sharing of data via an Intent and all components which allow sharing of data would be available for the user to select. Applications register themselves to an intent via an Intent Filter. Intents allow to combine loosely coupled components to perform certain tasks.

3.4. Services
Services

perform background tasks without providing an UI. They can notify the user via the

notification framework in Android.

3.5. ContentProvider
ContentProvider

provides an structured interface to data. Via a ContentProvider your application

can share data with other applications. Android contains an SQLite database which is frequently used in conjunction with a ContentProvider to persists the data of the
ContentProvider.

3.6. BroadcastReceiver
BroadcastReceiver

can be registered to receives system messages and Intents. BroadcastReceiver

will get notified by the Android system if the specified situation happens. For example a

12

BroadcastReceiver

could get called once the system completed its boot process or if a phone

call is received.

3.7. (HomeScreen) Widgets


Widgets

are interactive components which are primary used on the Android homescreen.

They typically display some kind of data and allow the user to perform actions via them. For example a Widget could display a short summary of new emails and if the user select a email it could start the email application with the selected email.

3.8. Other
Android provide much more components but the list above describes the most important ones. Other Android components are "Live Folders" and "Live Wallpapers". Live Folders display data on the homescreen without launching the corresponding application. 3.9 Compound Controls If you don't want to create a completely customized component, but instead are looking to put together a reusable component that consists of a group of existing controls, then creating a Compound Component (or Compound Control) might fit the bill. In a nutshell, this brings together a number of more atomic controls (or views) into a logical group of items that can be treated as a single thing. For example, a Combo Box can be thought of as a combination of a single line EditText field and an adjacent button with an attached PopupList. If you press the button and select something from the list, it populates the EditText field, but the user can also type something directly into the EditText if they prefer. In Android, there are actually two other Views readily available to do this: Spinner and AutoCompleteTextView, but regardless, the concept of a Combo Box makes an easy-tounderstand example. To create a compound component:

13

1. The usual starting point is a Layout of some kind, so create a class that extends a Layout. Perhaps in the case of a Combo box we might use a LinearLayout with horizontal orientation. Remember that other layouts can be nested inside, so the compound component can be arbitrarily complex and structured. Note that just like with an Activity, you can use either the declarative (XML-based) approach to creating the contained components, or you can nest them programmatically from your code. 2. In the constructor for the new class, take whatever parameters the superclass expects, and pass them through to the superclass constructor first. Then you can set up the other views to use within your new component; this is where you would create the EditText field and the PopupList. Note that you also might introduce your own attributes and parameters into the XML that can be pulled out and used by your constructor. 3. You can also create listeners for events that your contained views might generate, for example, a listener method for the List Item Click Listener to update the contents of the EditText if a list selection is made. 4. You might also create your own properties with accessors and modifiers, for example, allow the EditText value to be set initially in the component and query for its contents when needed. 5. In the case of extending a Layout, you don't need to override the onDraw() and onMeasure() methods since the layout will have default behavior that will likely work just fine. However, you can still override them if you need to. 6. You might override other on... methods, like onKeyDown(), to perhaps choose certain default values from the popup list of a combo box when a certain key is pressed. To summarize, the use of a Layout as the basis for a Custom Control has a number of advantages, including:

You can specify the layout using the declarative XML files just like with an activity screen, or you can create views programmatically and nest them into the layout from your code.

14

The onDraw() and onMeasure() methods (plus most of the other on... methods) will likely have suitable behavior so you don't have to override them. In the end, you can very quickly construct arbitrarily complex compound views and re-use them as if they were a single component.

CHAPTER 4 ANDROID DEVELOPMENT TOOLS

4.1. What are the Android Development Tools?


Google provides the Android Development Tools (ADT) to develop Android applications with Eclipse. ADT is a set of plug-in which extended the Eclipse IDE with Android development capabilities. ADT contains all required functionality to create, compile, debug and deploy Android applications from the Eclipse IDE and from the command line. Other IDE's, e.g. IntellJ, are also reusing components of ADT. ADT also provides an Android device emulator, so that Android applications can be tested without a real Android phone.

15

4.2. Dalvik Virtual Machine


The Android system uses a special virtual machine, i.e. the Dalvik Virtual Machine to run Java based applications. Dalvik uses special bytecode which is different from Java bytecode. Therefore you cannot run standard Java bytecode on Android.

4.3. How to develop Android Applications


Android applications are primary written in the Java programming language. The Java source files are converted to Java class files by the Java compiler. Android provides a tool dx which converts Java class files into a dex (Dalvik Executable) file. All class files of one application are placed in one compressed .dex file. During this conversion process redundant information in the class files are optimized in the .dex file. For example if the same String in different class file is found, the .dex file is stored only once and reference this String in the corresponding classes. .dex files are therefore much smaller in size then the corresponding class files. The .dex file and the resources of an Android project, e.g. the images and XML files are packed into an .apk (Android Package) file. The program aapt (Android Asset Packaging Tool) perform this packaging. The resulting .apk file contains all necessary data to run the Android application and can be deployed to an Android device via the "adb" tool. The Android Development Tools (ADT) allows that all these steps are performed transparent to the user; either within Eclipse or via the command line. If you use the ADT tooling you press a button or run a script and the whole Android application (.apk file) will be created and deployed.

16

CHAPTER 5 ANDROID APPLICATION ARCHITECTURE

5.1. Android Manifest.xml


An Android application is described in the file AndroidManifest.xml. This file must declare all components, e.g. Activities and Services of the application.

5.2. R.java and Resources


The " gen " directory in an Android project contains generated values. R.java is a generated class which contains references to certain resources of the the project. These resources must be defined in the res directory and can be XML files, icons or pictures. Via XML files you can for example define values, menus, layouts or animations.

17

If you create a new resource, the corresponding reference is automatically created in R.java. These references are static int values and define ID's for the resources. The Android system provides methods to access the corresponding resource via these ID's. For example to access a String with the reference id R.string.yourString use the method
getString(R.string.yourString)); .

R.java is automatically created by the Eclipse development environment, manual changes are not necessary.

5.3. Assets
While the directory res is contains structured values which are known to the Android platform the directory assets can be used to store any kind of data. In Java you can access this data via the AssetsManager and the getAssets() method .

5.4. Reference to resources in XML files


In your XML files, e.g. your layout files, you can refer to other resources via the @ sign. For example if you want to refer to a color you defined as resources you can refer to it via
@color/your_id @string/hello .

or if you have defined a "hello" string as resource you can access it via

5.5. Activities and Layouts


The user interface for Activities is defined via layouts. The layout defines the include Views (widgets) and their properties. A layout can be defined via Java code or via XML. You typically uses Java code to generate the layout if you don't know the content until runtime; for example if your layout depends on content which you read from the Internet.

18

XML based layouts are defined via a resource file in the folder /res/layout . This file specifies the ViewGroups, Views, their relationship and their attributes for a specific layout. If a UI element needs to be accessed via Java code you have to give the UI element an unique id via the android:id attribute. To assign a new id to an UI element use @+id/yourvalue. By conversion this will create and assign a new id yourvalue to the corresponding UI element. In your Java code you can later access these UI elements via the method
findViewById(R.id.yourvalue).

Defining layouts via XML is usually the preferred way as this separates the programming logic from the layout definition. It also allows the definition of different layouts for different devices. You can also mix both approaches.

5.6. Activities and Lifecycle


The operating system controls the life cycle of your application. At any time the Android system may stop or destroy your application, e.g. because of an incoming call. The Android system defines a life cycle for activities via pre-defined methods. The most important methods are:
onSaveInstanceState()

- called if the activity is stopped. Used to save data so that the

activity can restore its states if re-started


onPause()

- always called if the Activity ends, can be used to release resource or save - called if the Activity is re-started, can be used to initialize fields

data
onResume()

The activity will also be restarted if a so called "configuration change" happens. A configuration change for example happens if the user changes the orientation of the device (vertical or horizontal). The activity is in this case restarted to enable the Android platform to load different resources for these configuration, e.g. layouts for vertical or horizontal mode. In the emulator you can simulate the change of the orientation via CNTR+F11. You can avoid a restart of your application for certain configuration changes via the configChanges attribute on your activity definition in your AndroidManifest.xml. The

19

following activity will not be restarted in case of orientation changes or position of the physical keyboard (hidden / visible).

5.7. Context
The class android.content.Context provides the connections to the Android system. It is the interface to global information about the application environment. Context also provides access to Android Services, e.g. theLocation Service. As Activities and Services extend the class Context you can directly access the context via this.

CHAPTER 6 INSTALLATION

6.1. Pre-requisites for using a 64bit Linux


The Android SDK is 32bit, therefore on an 64bit Linux system you need to have the package ia32-libs installed. For Ubuntu you can do this via the following command. apt-get install ia32-libs Please check your distribution documentation if you are using a different flavor of Linux.

6.2. 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://dl-ssl.google.com/android/eclipse/. If you are not familiar with the Eclipse update manager the usage is described in Eclipse update manager.

20

After the new Android development components are installed you will be prompted to install the Android SDK. You can use the following wizard or go to the next section to learn how to do it manually.

6.3. Manually install Android SDK


The previous step downloads the Android SDK automatically for you. You can also download the Android SDK from the Android SDK download page. 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-sdk-windows". 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.

21

6.4. 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.

22

The dialog allows you to install new packages and also allows you to delete them. Select "Available packages" and open the "Third Party Add-ons". Select the Google API 14 (Android 4.0) version of the SDK and press "Install".

23

Press the "Install" button and confirm the license for all packages. After the installation completes, restart Eclipse.

24

25

26

CHAPTER 7 ANDROID VIRTUAL DEVICE EMULATOR

7.1. What is the Android Emulator?


The Android Development Tools (ADT) include an emulator to run an Android system. The emulator behaves like a real Android device (in most cases) and allows you to test your application without having a real device. You can configure the version of the Android system you would like to run, the size of the SD card, the screen resolution and other relevant settings. You can define several devices with different configurations. Via the emulator you select which device should be started, you can also start several in parallel. These devices are called "Android Virtual Device" (AVD). The ADT allow to deploy and run your Android program on the AVD.

7.2. Google vrs. Android AVD


During the creation of an AVD you decide if you want an Android device or an Google device. An AVD created for Android will contain the programs from the Android Open Source Project. An AVD created for the Google API's will also contain several Google applications, most notable the Google Maps application. If you want to use functionality which is only provided via the Google API's, e.g. Cloud2DeviceMessaging or Google Maps you must run this application on an AVD with Google API's.

27

7.3. Emulator Shortcuts


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.

7.4. Performance
Try to use a smaller resolution for your emulator as for example HVGA. The emulator gets slower the more pixels its needs to render as it is using software rendering. Also if you have sufficient memory on your computer, add at least 1 GB of memory to your emulator. This is the value "Device ram size" during the creation of the AVD. Also set the flag "Enabled" for Snapshots. This will save the state of the emulator and let it start much faster.

7.5. Hardware button


Android 4.0 introduced that devices do not have to have hardware button anymore. If you want to create such an AVD, add the "Hardware Back/Home keys" property to the device configuration and set it to "false".

28

29

CHAPTER 8
SCREENSHOTS

30

31

32

33

CHAPTER 9 CONCLUSION
Android is a truly open, free development platform based on Linux and open source. Handset makers can use and customize the platform without paying a royalty. A component-based architecture inspired by Internet mash-ups. Parts of one application can be used in another in ways not originally envisioned by the developer. can even replace built-in components with own improved versions. This will unleash a new round of creativity in the mobile space.

Android is open to all: industry, developers and users Participating in many of the successful open source projects Aims to be as easy to build for as the web. Google Android is stepping into the next level of Mobile Internet

34

CHAPTER 10 FUTURE SCOPE

Android has been criticized for not being all open-source software despite what was announced by Google. Parts of the SDK are proprietary and closed source, and some believe this is so that Google can control the platform. Software installed by end-users must be written in Java, and will not have access to lower level device APIs. This provides end-users with less control over their phone's functionality than other free and open source phone platforms, such as OpenMoko. With all upcoming applications and mobile services Google Android is stepping into the next level of Mobile Internet. Android participates in many of the successful open source projects. That is, architect the solution for participation and the developers will not only come but will play well together. The future scope for this application is that we can change the static setting of database to dynamic so that it can be modified to a enhanced application. Administrator will be provided with the option of editing the courses and fields within them respectively.

35

CHAPTER 11 REFERENCES 1. http://www.android.com - Android Official Webpage 2. http://code.google.com/android/ - Official Android Google Code Webpage 3. http://www.openhandsetalliance.com/ - Open Handset Alliance Webpage 4. http://www.androidwiki.com Android Wiki 5. http://googleblog.blogspot.com/ Official Google Blog 6. http://en.wikipedia.org/wiki/Android_(mo...Wikipedia Information 7. http://en.wikipedia.org/wiki/SQLite 8. http://en.wikipedia.org/wiki/WebKit 9. http://en.wikipedia.org/wiki/Eclipse_(software) 10. http://www.itworld.com/google-android-dr-080213

36

You might also like