T57 Platform Technologies LAB MANUAL Documented by P.Karthikeyan Department of Information Technology Thiagarajar College of Engineering Madurai-625015
LIST OF EXPERIMENTS 1. Implementation of Collection Classes and Objects 2. Implementation of utility package classes 3. Operations on Java Archive (JAR) file 4. Creation of Logs using Logging API 5. Monitor and Manage the JVM using jconsole tool 6. Implementation of storage and retrieval of user and system data using Preference API 7. Installation of Android SDK and Setting up the Android ADE 8. Creation and Execution of a Simple Android Application 9. Designing a Simple Calculator 10. Designing and Development of Feedback Form for an Event 11. Designing and Development of a Mobile Shopping Application 12. Designing and Development of a real time application using SQLite [2]
Ex: 1 Implementation of Collection Classes and Objects a) Problem: Create separate array lists to store the filenames based on the file types from the given directory and perform the following tasks: i) Search a file from the list ii) Count the file names in each list Packages Interface Classes : Utility, IO : FilenameFilter : File, ArrayList : list, accept, size, add, remove etc. b) Problem: Implement the queue and stack concepts using linked list operations and perform the following tasks in both. i) Search an element ii) Count the elements Packages Class : Utility : LinkedList : addfirst, addlast, removefirst, removelast, getfirst, getlast etc. [3]
Ex: 2 Implementation of Utility Package Classes a) Problem: Create an employee payroll list of an organization and perform the following tasks: i) Calculate the salary based on the basic_pay ii) search a particular employee based on his empid iii) Find the employees who are all having the salary < 5000 iv) Find the employees based on their designation Package Class : Utility : LinkedList, StringTokenizer : addfirst, addlast, removefirst, removelast, getfirst, getlast, nextelement, nexttoken, counttokens etc. b) Problem: Generate EB bill for various consumers who are all paid their EB charge in a particular date but in different time and create separate method to calculate the bill amount based on consumed units. Package Class : Utility : LinkedList, Date, Timer, TimerTask : addfirst, addlast, removefirst, removelast, getfirst, getlast, gettime, settime, run, schedule etc. EB Bill Format (Expected Output Format) ------------------------------------------------------------------------------ Tamil Nadu Electricity Board Madurai Date & Time: Mon Apr 22 09:51:52 2010 Bill No.:201 ------------------------------------------------------------------------------ Consumer Name : Arun Total Units Consumed : 210 Price per Unit : Rs.6.00 ------------------------------------------------------------------------------ Total Cost : Rs.1260 ------------------------------------------------------------------------------ [4]
Ex: 3 Operations on Java Archive (JAR) file a) Problem: Develop a book shop application and perform the following tasks. i) Create a JAR file ii) View the contents of a JAR file iii) Extract the contents of a JAR file iv) Update the JAR file v) Run the application through JAR Write the basic format for doing all the above operations in the description part. b) Problem: Develop an applet for address book and perform the following tasks. i) Create a JAR file ii) View the contents of a JAR file iii) Extract the contents of a JAR file iv) Update the JAR file v) Run the application through JAR Write the basic format for doing all the above operations in the description part. [5]
Ex: 4 Creation of Logs using Logging API a) Problem: Create a log report for a cooking application from the given raw materials using logging API. Generate the logs or log records for the following scenarios. i) Generate CONFIG level log in display the Maximum limits of the materials. ii) Generate INFO level log for every insertion operation. iii) Generate INFO level log for every deletion operation. iv) Generate WARNING level log during search a particular material. v) Generate SEVERE level log during the recipe preparation. Package Class Fields : logging : Logger, LogManager, Level, Handler, LogRecord, Formatter : getlogger, getlogmanager, addloger, addhandler, log, publish, close, etc. : Level. CONFIG, Level. SEVERE, Level.WARNING, Level.INFO etc. b) Problem: Create a log report for library management application using logging API. Generate the logs or log records for the following scenarios. i) Generate CONFIG level log in display the Maximum limits of the rack, Maximum no. of book issue for students, staffs. ii) Generate INFO level log for every insertion operation. iii) Generate INFO level log for every deletion operation. iv) Generate SEVERE level log during the book issue operation. v) Generate WARNING level log during search a particular book. Package Class Fields : logging : Logger, LogManager, Level, Handler, LogRecord, Formatter : getlogger, getlogmanager, addloger, addhandler, log, publish, close, etc. : Level. CONFIG, Level. SEVERE, Level.WARNING, Level.INFO etc. [6]
Ex: 5 Monitor and Manage the JVM using jconsole tool Problem: Connect the jconsole tool with local process and note down how the monitoring is takes place in Threads, Classes and Memory. [7]
Ex: 6 Implementation of Storage and Retrieval of User and System data using Preference API a) Problem: Create a tree for the files system hierarchy of your system and perform the following tasks. (Important: Node s key values are like Name description, Size, Type, Date, etc.) i) Insert all the nodes with its key details. ii) Display the total file system hierarchy iii) Search for a particular system file details and its path iv) Display the list of files and sub directories of a given directory b) Problem: Create a tree for the university information system hierarchy and perform the following tasks. i) Insert all the nodes with its key details. ii) Display the total system hierarchy iii) Search for a particular College details iv) Display the list of courses offered in a particular college [8]
Ex: 7 Installation of Android SDK and Setting up the Android Application Development Environment Android SDK Installation: 1. Download the latest SDK package suitable for your OS from http://developer.android.com/sdk/index.html#quickstart 2. Unzip the Android SDK archive to a suitable location on your machine. 3. Add the location of the SDK's primary tools directory to your system PATH. In Windows, right-click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path (under System Variables). Add the full path to the tools/ directory to the path. Eclipse Installation: 1. Download the Eclipse package (Eclipse IDE for Java EE Developers) from http://www.eclipse.org/downloads/ 2. Unzip the Eclipse archive to a suitable location on your machine. ADT Plugin Installation: 1. Start Eclipse, then select Help > Install New Software. 2. In the Available Software dialog, click Add... 3. In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the "Name" field. In the "Location" field, enter this URL:https://dl-ssl.google.com/android/eclipse/ Click OK. 4. Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next. [9]
5. In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. 6. Click Next to read and accept the license agreement and install any dependencies, then click Finish. 7. Restart Eclipse. Android Virtual Device (AVD) Creation: 1. In Eclipse, choose Window > Android SDK and AVD Manager. 2. Select the Install Packages in the left panel. If all the packages are already installed then go to step 4 otherwise go to next step. 3. Select the Available packages in the left panel and install all the software which is listed by the URL. 4. Select Virtual Devices in the left panel. 5. Click New. The Create New AVD dialog appears. 6. Type the name of the AVD, such as "my_avd". 7. Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.1) you want to run on the emulator. 8. You can ignore the rest of the fields for now. 9. Click Create AVD. [10]
Ex: 8 Creation and Execution of a Simple Android Application Creation of a Simple Android Application: 1. Select File > New > Project. 2. Select Android > Android Project, and click Next. 3. Select the contents for the project: Enter a Project Name. This will be the name of the folder where your project is created. 4. Under Contents, select Create new project in workspace. Select your project workspace location. 5. Under Target, select an Android target to be used as the project's Build Target. The Build Target specifies which Android platform you'd like your application built against. 6. Under Properties, fill in all necessary fields. Enter an Application name. This is the human-readable title for your application (the name that will appear on the Android device). Enter a Package name. This is the package namespace where all your source code will reside. (Following the same rules as for packages in the Java) Select Create Activity (optional, of course, but common) and enter a name for your main Activity class. Enter a Min SDK Version. This is an integer that indicates the minimum API Level required to properly run your application. 7. Click Finish. Contents (folders and files) in new Android Project: src/ Includes your stub Activity Java file. All other Java files for your application go here. <Android Version>/ (e.g., Android 2.1/) Includes the android.jar file that your application will build against. This is determined by the build target that you have chosen in the New Project Wizard. [11]
gen/ This contains the Java files generated by ADT, such as your R.java file and interfaces created from AIDL files. assets/ This is empty. You can use it to store raw asset files. res/ A folder for your application resources, such as drawable files, layout files, string values, etc. AndroidManifest.xml The Android Manifest for your project. The manifest presents essential information about the application to the Android system. Information the system must have before it can run any of the application's code. default.properties This file contains project settings, such as the build target. This files is integral to the project, as such, it should be maintained in a Source Revision Control system. It should never be edited manually To edit project properties, right-click the project folder and select "Properties". Run the Android Application: An Android application can be run in 2 modes (Run mode, Debug mode) To Run it in the run mode, select Run> Run (Ctrl+F11) > Android Application To Run it in the debug mode, select Run > Debug (F11) > Android Application [12]
Ex: 9 Designing of a Simple Calculator Problem: Design a simple calculator to perform add, subtract, multiply and divide two numbers using android. Package Classes Layout Coding: : android.app, android.os, android.widget, android.view etc. : Activity, Bundle, View, Button etc. : oncreate, setcontentview, onpause, onresume, setonclicklistener etc. : TableLayout and its properties Java source main.xml AndroidManifest.xml [13]
Ex: 10 Designing and Development of Feedback Form for an Event Problem: Design and develop a feedback form for any event of your college and perform validation. Package Classes Layout : android.app, android.os, android.widget, android.view etc. : Activity, Bundle, View, Button, Toast, CheckBox, RadioButton etc. : oncreate, setcontentview, onpause, onresume, setonclicklistener etc. : TableLayout/ LinearLayout and its properties Coding: Java source main.xml AndroidManifest.xml [14]
Ex: 11 Designing and Development of a Mobile Shopping Application Problem: Design and develop an application for mobile shopping. Package Classes Layout : android.app, android.os, android.widget, android.view etc. : Activity, Bundle, View, Button, ImageView, CheckBox etc. : oncreate, setcontentview, onpause, onresume, setonclicklistener etc. : TableLayout/ LinearLayout and its properties Coding: Java source main.xml AndroidManifest.xml [15]
Ex: 12 Designing and Development of a Real Time Application using SQLite Problem: Design and develop an insurance application using SQLite database. Package Classes Layout : android.app, android.os, android.widget, android.view, android.database, android.database.sqlite, android.content etc. : Activity, Bundle, View, Button, ImageView, CheckBox, Cursor, SQLiteDatabase, SQLiteOpenHelper, ContentValues etc. : oncreate, setcontentview, onpause, onresume, setonclicklistener, query, getwritabledatabase, insert, delete etc. : TableLayout/ LinearLayout and its properties Coding: Java source (Design & Database) main.xml AndroidManifest.xml [16]