ce53105 3 applied communications technology android lecture 2 structures
Skip this Video
Download Presentation
CE53105-3 Applied Communications Technology Android lecture 2 - Structures

Loading in 2 Seconds...

play fullscreen
1 / 10

CE53105-3 Applied Communications Technology Android lecture 2 - Structures - PowerPoint PPT Presentation

  • Uploaded on

CE53105-3 Applied Communications Technology Android lecture 2 - Structures. Android File structure Resources Drawables Layout Values R Class Manifest Running programs DDMS ( Dalvik Debug Monitor Server ) Explaining Interesting things in Notes3. Android File Structure.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'CE53105-3 Applied Communications Technology Android lecture 2 - Structures' - kathy

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
ce53105 3 applied communications technology android lecture 2 structures
CE53105-3 Applied Communications TechnologyAndroid lecture 2 - Structures
  • Android File structure
    • Resources
      • Drawables
      • Layout
      • Values
    • R Class
    • Manifest
  • Running programs
  • DDMS ( Dalvik Debug Monitor Server )
  • Explaining Interesting things in Notes3
android file structure
Android File Structure

Layout XML files – Used by Activities to define screens

Your Project – Should be a unique name

Generated folder – R class here – leave alone

Resource folder – XML files defining resources

Source objects for Android platform target

The Manifest – Declares all bits of project

Drawable Folders – Picture, image, icons etc

Values folder – In this case a strings XML doc

Individual Java source files

Source folder – all java files you create

drawable folders
Drawable Folders
  • Contains images that will be used in your programs
    • Generally three (or one)
      • Drawable-hdpi – high resolution screen
      • Drawable –mdpi – medium resolution
      • Drawable- ldpi – low resolution
    • Means you may need several versions of your image to suit the screen resolution!
      • Becoming a problem as sizes proliferate
  • Referenced using the R class
layout folder
Layout folder
  • Contains XML documents that define the layout of a particular view.
  • Activity’s utilise views by the setcontextview statement.
    • setContentView(R.layout.tigger1);
  • Layouts can be complex and difficult to build
    • DroidDraw - http://www.droiddraw.org

?xml version="1.0" encoding="utf-8"?>









  • Files containing tuples of data
    • name and value Name – Hello value – Hello World
  • Can be simple or complex data items
    • Arrays, menus etc

Hello World, Viewdemo!










the r class
The R Class


package ac.uk.ere1.Viewdemo;

public final class R {

public static final class array {

public static final int countries_array=0x7f050000;


public static final class attr {


public static final class drawable {

public static final int icon=0x7f020000;


public static final class id {

public static final int entry=0x7f060001;

public static final int label=0x7f060000;

public static final int ok=0x7f060002;


public static final class layout {

public static final int linearlayoutdemo=0x7f030000;

public static final int list_item=0x7f030001;

public static final int main=0x7f030002;

public static final int relativelayoutdemo=0x7f030003;


public static final class string {

public static final int app_name=0x7f040001;

public static final int hello=0x7f040000;



  • contains resource IDs for all the resources in your res/ directory
    • Generated by aapt (Android Asset Packaging Tool)
    • For each type of resource, there is an R subclass
    • for each resource of that type, there is a static integer
    • To use the resource simply add it to your code
      • R.string.hello or 0x7f040000
      • R.layout.linearlayoutdemo or 0x7f030000
      • R.array.countries_array or 0x7f050000
  • Means that you can change details without having to change the code!
the ddms perspective
The DDMS Perspective

Emulators Running

Directory Structure of emulator (can push and pull files)

Emulator controls – can simulate various phone actions eg receiving a call or gaining GPS input

Log provides useful information on what is happening live!

android manifest
Android Manifest

Package definition

Permissions Required

Intent Filter defines what it can do





android:name="Listview" />

android:name="Linearlayout" />

android:name="Relativelayout" />


Activities Commented out

notepadv3 cont
Notepadv3 (cont)

1- @overide – places an existing definition of the method.

2- super is the root definition and is called to ensure all methods and properties are properly instantiated.

3- setContentview(R.layout.notes_list) –

used to define the view being used by the activity.

In this case note_list!

4- a- call to a method defined in this class.

b- the method definition.

5- Intent starting a new activity (ACTIVITY_CREATE)

Note it expects the activity to return a result!

6- Intent starting a new activity (ACTIVITY_EDIT)

Also expecting a result to be returned.

Note i.putExtra method – allows data to be transmitted to activity.

7- The method dealing with the result returned.

8- Have to create ‘listeners’ for each view item – problematical!