CE53105-3 Applied Communications Technology Android lecture 2 - Structures Android File structure Resources Drawables Layout Values R Class Manifest Running.

Slides:



Advertisements
Similar presentations
Android Development Tutorial Yi Huang. Contents 2  What’s Android  Android architecture  Android software development  ‘Hello World’ on Android 
Advertisements

Joemarie Comeros Amparo Android Development Orientation for Starters.
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Android Terminology Component: Activities, content providers, broadcast receivers, and services that together make up an application Activity: A single.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
More Java: Encapsulation, Getters, Setters, Anonymous Class 1 CS300.
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Android Life Cycle CS328 Dick Steflik. Life Cycle The steps that an application goes through from starting to finishing Slightly different than normal.
Android and Project Structure. Android Android OS – Built on Linux Kernel – Phones – Netbooks – Readers – Other???
Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared.
Android GUI Project John Hurley CS 454. Android 1. Android Basics 2. Android Development 3. Android UI 4. Hello, World 5. My Project.
App Development for Android Prabhaker Mateti. Development Tools (Android) Java – Java is the same. But, not all libs are included. – Unused: Swing, AWT,
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
Layout and Control in UI The user interface (UI) is the graphical interface user can see and interact with your app comprising UI controls like textbox,
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Android Programming. Outline Preparation Create new project Build and Run a project Debug a project Deploy on devices.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Introducing the Sudoku Example
Chapter 3 Navigating a Project Goals & Objectives 1.Get familiar with the navigation of the project. How is everything structured? What settings can you.
CS5103 Software Engineering Lecture 08 Android Development II.
1 Mobile Computing Monetizing An App Copyright 2014 by Janson Industries.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Chapter 2: Simplify! The Android User Interface
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
1 Announcements Homework #2 due Feb 7 at 1:30pm Submit the entire Eclipse project in Blackboard Please fill out the when2meets when your Project Manager.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
Copyright © Curt Hill Java Looking at our first console application in Eclipse.
Resources. Application Resources Resources are strings, images, and other pieces of application information that are stored and maintained (externalized)
Configuring Android Development Environment Nilesh Singh.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
1 Introducing Activity and Intent. 2 Memory LinearLayout, weight=2 LinearLayout, weight=1 TextView ListView.
Announcements Homework #2 will be posted after class due Thursday Feb 7, 1:30pm you may work with one other person No office hours tonight (sorry!) I will.
Android App Basics Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5.
ANDROID – A FIRST PROGRAM L. Grewe Using AndroidStudio –basic Android  Lets do a “Hello World Project”  Start up AndroidStudio (assume you have installed.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
Resources & Android Manifest Калин Кадиев Astea Solutions AD.
INTRODUCTION TO ANDROID. Slide 2 Introduction I take a top-down approach to describing an application’s anatomy.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Introduction to Android Chapter 1 1. Objectives Understand what Android is Learn the differences between Java and Android Java Examine the Android project.
Android Programming.
Lab7 – Appendix.
Android Programming - Features
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Introduction Hello World
Android Application Development 1 6 May 2018
Android N Amanquah.
GUI Programming Fundamentals
Android Introduction Hello World.
Android Introduction Camera.
תכנות ב android אליהו חלסצ'י.
Mobile Device Development
Anatomy of an Android Application
Android GUI Project John Hurley CS 454.
CA16R405 - Mobile Application Development (Theory)
Many thanks to Jun Bum Lim for his help with this tutorial.
Android GUI Project John Hurley CS 454.
CMPE419 Mobile Application Development
Android Developer Fundamentals V2 Lesson 1
CA16R405 - Mobile Application Development (Theory)
CMPE419 Mobile Application Development
CA16R405 - Mobile Application Development (Theory)
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

CE 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 Source folder – all java files you create Your Project – Should be a unique name Individual Java source files 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 Layout XML files – Used by Activities to define screens

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 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 - ?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" />

Values 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! Viewdemo Bahrain Bangladesh Barbados Belarus Belgium Belize Benin

The R Class 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 0x7f R.layout.linearlayoutdemo or 0x7f R.array.countries_array or 0x7f Means that you can change details without having to change the code! /* AUTO-GENERATED FILE. DO NOT MODIFY. 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; }

The DDMS Perspective Emulators Running Emulator controls – can simulate various phone actions eg receiving a call or gaining GPS input Directory Structure of emulator (can push and pull files) Log provides useful information on what is happening live!

Android Manifest <manifest xmlns:android=" package="ac.uk.ere1.Viewdemo" android:versionCode="1" android:versionName="1.0“ <activity android:name=".Viewdemo" <activity android:name="Listview" /> <activity android:name="Linearlayout" /> <activity android:name="Relativelayout" /> <!-- <activity android:name="Tablelayout" /> --> Package definition Intent Filter defines what it can do Permissions Required Activities Commented out Activities

Notepadv3 Key Points

Notepadv3 (cont) – 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!