CS5103 Software Engineering

Slides:



Advertisements
Similar presentations
Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
Advertisements

Intro to Android Development. Getting started 1.Install Android SDK (includes Eclipse; 2.If using Windows.
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
The Android Development Environment.  Getting started on the Android Platform  Installing required libraries  Programming Android using the Eclipse.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
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
Better reference the original webpage :
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.
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
CS5103 Software Engineering Lecture 08 Android Development II.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
Basic Android Tutorial USF’s Association for Computing Machinery.
DUE Hello World on the Android Platform.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
Presented By: Muhammad Tariq Software Engineer Android Training course.
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.
Android Boot Camp for Developers Using Java, 3E
Configuring Android Development Environment Nilesh Singh.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Android Hello World 1. Click on Start and type eclipse into the textbox 2.
Creating an Example Android App in Android Studio Activity lifecycle & UI Resources.
First Venture into the Android World Chapter 1 Part 2.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
Building User Interfaces Basic Applications
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
Introduction to Android Programming
Chapter 2: Simplify! The Android User Interface
Development Environment
Android 01: Fundamentals
Open Handset Alliance.
Getting Started with Application Software
Mobile Application Development Chapter 3 [Using Eclipse Android Studio for Android Development] IT448-Fall 2017 IT448- Fall2017.
Android Studio, Android System Basics and Git
Activities and Intents
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
The Android Activity Lifecycle
Chap 7. Building Java Graphical User Interfaces
Introduction to Computers
Android SDK & App Development
Graphical User Interfaces -- Introduction
Android Programming Lecture 3
CS323 Android Getting Started
Application Development A Tutorial Driven Course
Building User Interfaces Basic Applications
Android Developer Fundamentals V2 Lesson 1
HNDIT2417 Mobile Application Development
Programming Mobile Applications with Android
Mobile Programming Dr. Mohsin Ali Memon.
Introduction to Android
University of Warith AL-Anbiya’a
Mobile Programmming Dr. Mohsin Ali Memon.
Android Development Introduction to Android Development 2011/01/16
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

CS5103 Software Engineering Lecture 07 Android Development II

Last class 2 Projects Android Development I Process and Evaluation Requirements Calendar SMS Messenger Contact Manager Book Shelf Android Development I Android system & Emulator Environment Setup 2

Today’s class Basic Android Development 3 Structure of an android project Basic UI Components Activities and Lifecycle Action bars 3

Set environment variables Set Android_SDK_Home: %Android_SDK_Home%/.android will be the place all virtual devices stored You may set your sdk directory as Android_SDK_Home Add dirs to PATH env variable Your sdk directory/tools Your sdk directory/platform-tools 4

Structure of an Android Project Source code Generated code Manifest file Resource files 5

Source code & generated code The code you will work on Activities Typically mainly implementing system call backs Generated code The code generated by the system according to your resource files R.java Including references to all fields in resource files Do not edit it 6

Main components of android apps Activities Services Broadcast Receivers They usually can be executed directly with intents Intents Messages sent and received between components System intents 7

Activities Most important component of an android app 8 An activity is basically everything showed at one time on the screen Like window or frame in the desktop UI applications Explore an app by trigger different activities An activity has its own resource files 8

Manifest file Package name Versions targeted at Activities Intent filters Permissions Uses-permissions Declare permissions 9

Permissions 10 System permissions User defined permissions Network Reading/Writing/Sending/Receiving sms Making/Receiving calls Reading/writing contacts Reading/writing SD cards … http://developer.android.com/reference/android/Manifest.permission.html User defined permissions 10

Resource files 11 Source code Generated code The code you will work on Activities Typically mainly implementing system call backs Generated code The code generated by the system according to your resource files R.java Including references to all fields in resource files Do not edit it 11

Resource files Drawable Layout Menu 12 Icons used in the app An xml file describing the layout of an activity Eclipse-ADT provides a graphics layout, and maintain the consistency Menu An xml file describing the menu of an activity 12

Resource files Values Dimensions Strings Styles (color, fonts, etc.) A project usually has multiple value folders for different targeted devices Dimensions for different device size Strings for different languages 13

Today’s class Basic Android Development 14 Play with Emulator Structure of an android project Basic UI Components Activities and Lifecycle Action bars 14

Basic UI Components Views ViewGroup 15 Basic UI component Button, Checkbox, MenuItem, etc. ViewGroup A invisible container that holds views Determines how views are placed in the container LinearLayout, GridLayout, AbsoluteLayout, etc. 15

Views and View Groups 16

Basic UI Components Views ViewGroup 17 Basic UI component Button, Checkbox, MenuItem, etc. ViewGroup A invisible container that holds views Determines how views are placed in the container LinearLayout, RelativeLayout, GridView, ListView 17

Add views/viewgroups to a project All views and view groups can be added by Editing layout resource file of an activity (recommended) Edit the graphics layout Set main attributes Height Width Text / hint 18

Layouts Linear layouts 19 Views are placed in a vertical or horizontal list The default size of views are “wrap_content” You may set weight for views to make them occupy more spaces 19

Layouts Relative layouts 20 Views are placed relative to their neighbors Views are places from top-left corner by default Avoid too much hierarchies 20

Layouts List Views 21 Bind to ListActivity A vertical list of scrollable items Use Adaptor to build and manage items 21

Layouts Grid Views Display items in a two-dimensional scrollable grid Use adaptors to build view and manage items 22

An example of input and display messages 23

Respond to UI components Add the onclick attribute The content of the attribute is the name of method to be executed Access data in the current activity Find view by id Do not forget to set an id for the views you want to get data from 24

Respond to UI components Requirement to the responding method Public Return type is void Has a single parameter: android.view.View Otherwise the system will not be able to call the responding method 25

Start another activity Create a new activity Add it to multiple places (done automatically by eclipse) Source code Manifest file Resource files for the new activity Generate an intent to start the activity 26

Activity life cycles 27 Create Start Pause: Resume Stop Destroy The activity become fully visible to the user Pause: The activity is partially visible, e.g., pop-up window Resume The activity is fully visible again Stop The activity is hidden Destroy 27

Activity life cycles 28

Menus Menus are by default in the project Each activity has a menu resource file A empty action called settings is listed in the menu Since phone screens are quite small, menu provide a place to put extra buttons that cannot be put onto the screen 29

Add items to menus Add item to the resource file Add ids to each item Implement the method: onOptionsItemSelected(MenuItem item) 30

Today’s class Basic Android Development 31 Play with Emulator Structure of an android project Basic UI Components Activities and Lifecycle Action bars 31

Thanks! 32

Start an emulator In eclipse In command line 33 Go to device manager Click Start In command line emulator –avd ‘virtual device name’ 33

On the emulator 34 Use your keyboard to input text Useful Shortcuts Home -> Home Esc -> back F2 -> Menu Ctrl + F12 -> change orientation Manage Apps Go to menu -> manage apps Operating everything as on a phone 34

Adb interface 35 A very useful tool for controlling emulator adb devices: show all running emulators Install and uninstall apps adb push & pull: transfer data between the host system and the emulator adb logcat: print the system log of the emulator adb shell: access the file system of the emulator Manage files in the virtual device adb shell pm: List all installed apps 35

Telnet interface 36 telnet localhost <port number> Simulate a number of events Phone calls gsm call <number> SMS sms send <number> <“text”> Power level power status charging / not-charging, power capacity <percentage> Set GPS geo fix <longitude> <latitude> 36

Today’s class Basic Android Development 37 Play with Emulator Structure of an android project Basic UI Components Activities and Lifecycle Action bars 37