2

MOBILE APPLICATION DEVELOPMENT LAB CS-6611 / IT-6611 Exercise - 2 Develop an application that uses Layout Managers and ...

0 downloads 216 Views 16MB Size
MOBILE APPLICATION DEVELOPMENT LAB CS-6611 / IT-6611

Exercise - 2 Develop an application that uses Layout Managers and Event Listeners

New No.1, Vembuliamman Koil Street Pazhavanthangal, Chennai – 600 114 Phone: 98841-65649, 98847-36775 E-mail: [email protected]

DIGI-MAT D IGITAL M EDIA A CCESS T ERMINAL

N P T E L National Programme on Technology Enhanced Learning (A Joint Initiative of IITs and IISc - Funded by Ministry of HRD, Govt. of India)

V I R T U A L Search 20,500

+

Access

C L A S S R O O M View

Listen

Copy

Share

N P T E L E-Learning Educational Video Lectures with Sub-Titles

DIGI-MAT

: The Digital Media SET-TOP Box for Virtual Class Room Setup

Phone: 98841 65649, 98847 36775, 98847 36552 E-mail: [email protected]

DIGI-MAT D IGITAL M EDIA A CCESS T ERMINAL Digi-MAT is a Digital Media SET-TOP Box with Multimedia Operating System (OS) based on Popular Kodi Media Center for Organizing and Playing Audio / Video Files as Library Digi-MAT is useful for setting up Virtual Class Rooms / Virtual Study Centres were Users can listen to Video and Audio Lectures from their place of convenience in the LAN Environment Digi-MAT uses industry standard Network File System (NFS) Protocol for Faster Video Streaming in the User Computer eliminating the need of a separate Streaming server Digi-MAT is scalable to use on any no of Computers in the Network due to its Superior Technical Design and Innovative Development Process using Open Standards Digi-MAT does not require any Installation / Configuration in Desktop (or) Laptop Computers. It can remotely boot over Network through PXE Boot Technology Digi-MAT Remotely boots in less than 30-40 Seconds over network and ready for use Automatically configures all Hardware Devices (Audio, Video, Network, Storage devices etc.) Highly Customizable User Interface for Configuring various settings in Digi-MAT Digital Media access from Local Hard Disk / Network Attached Storage (NAS) / Internet Firefox Web Browser is included in the Digi-MAT OS for Internet / Digital Repository access (for viewing PDF / HTML Document Types) Digi-MAT Supports nearly all types of Popular Audio and Video file formats (MP3, MP4, FLV, AVI, MKV, WEBM, MOV, OGV, MPG, WMV, ASF, WAV etc.) Media Informations are stored in SQLite Embedded Database for Faster Search / Retrieval Integrated SEARCH facility from the Desktop to search from thousands of Digital Media files Users can FILTER Digital Media contents in 'Realtime' using Specific search string Bookmarking facility for frequently accessed Digital Media Contents with Resuming option Text-To-Speech (TTS) Engine for Screen Reading facility (useful for visually impaired users) Automation Tools for Converting Video file details into XML Format for Importing into Database Export facility of Video file details from SQLite Database into XML file format Users can Login (or) Load different 'PROFILES' for viewing Videos from Different Categories Users can Copy the Media contents in External Storage Devices through Built-in File Manager Users can Remotely connect to Windows RDP Servers using Advanced Application Launcher

Layout and Event Listeners  1 

Layout and Event Listeners Part 1: 

Start a new project. (API Level 14 – Android 4.0 Ice­cream Sandwich).  Part 2:  

Layouts  1. Relative Layout  As in name this layout positions elements relative to the adjacent elements.  It uses the following attributes for each element to position them:       

layout:alignEnd  layout:alignStart  layout:toEndOf  layout:toStartOf  layout:alignParent  layout:centreInParent 

We will create a TextView (Large) inside the parent Relative layout by editing the xml  code:   

Copyright © Arjun P (Arjun Atlast)  

 

Copyright (c) LinuXpert Systems, Chennai

fb/arjunatlast 

Layout and Event Listeners  2  Now we have created a TextView. 

 

 

2. Linear Layout  Linear layout are two types Horizontal and Vertical.  Horizontal/Vertical is set using the orientation attribute.  In such layout the elements are arranged in order top­to­bottom or left­to­right.  Let’s add a Linear Layout now. (Now you can use the drag and drop layout editor). Change  orientation to Vertical.  Now add an ImageView to the Linear Layout.  Import an image to the drawable directory. (Just as we have imported font­face in previous  chapter).  Set the src attribute to the drawable we imported. (Click the browse button and select the file  from Drawable directory). 

Copyright © Arjun P (Arjun Atlast)  

 

Copyright (c) LinuXpert Systems, Chennai

fb/arjunatlast 

Layout and Event Listeners  3 

 

 

3. Table Layout:  As we all know table layout uses rows and columns to position elements.  Add table layout inside the linear layout. Table layout uses TableRow layout to create rows.  Add a TableRow to the TableLayout. Add two Buttons to the TableRow.  Change the Id’s of the two Buttons to btnClick and btnLongClick respectively.   

we will use these buttons to implement event listeners 

Change text to Click Me! and Long Click Me! also.  Select one of the buttons from the component tree. Pay attention to Properties window. You can see  layout:span and layout:column attributes. The table layout uses these attributes to position elements. If the values are unset then uses default values (span=1 and column increments according to order of  placement).  Copyright © Arjun P (Arjun Atlast)  

 

Copyright (c) LinuXpert Systems, Chennai

fb/arjunatlast 

Layout and Event Listeners  4  4. Grid Layout  This is a very useful layout. This layout has order as well as freedom.  This layout uses orderly grids with rows and columns , span and spaces.  Add a GridLayout below the table layout.  Now drag and drop a Button to the GridLayout.   You’ll see a green grid with many blocks. 

  Example: 

  Select this button and you can see that it uses attributes layout:column, layout:row, layout:rowSpan,  layout:columnSpan. These are the attributes to position to items in GridLayout.  Change the rowSpan to 3. resize the button  Add one more button and a text field.  Edit the xml file to position them correctly: