EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

Similar documents
EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

Tip Calculator. xmlns:tools=" android:layout_width="match_parent"

Fragment Example Create the following files and test the application on emulator or device.

Create Parent Activity and pass its information to Child Activity using Intents.


Arrays of Buttons. Inside Android

EMBEDDED SYSTEMS PROGRAMMING Android NDK

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Intents. Your first app assignment

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

EMBEDDED SYSTEMS PROGRAMMING Android Services

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

EMBEDDED SYSTEMS PROGRAMMING Android NDK

Fragments. Lecture 11

PROGRAMMING APPLICATIONS DECLARATIVE GUIS

Manifest.xml. Activity.java

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

SD Module-1 Android Dvelopment

<uses-permission android:name="android.permission.internet"/>

Produced by. Mobile Application Development. Eamonn de Leastar

android-espresso #androidespresso

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

User Interface Development in Android Applications

Basic GUI elements - exercises

Create a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks.

Android - JSON Parser Tutorial

Software Practice 3 Before we start Today s lecture Today s Task Team organization

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences

Mobile Software Development for Android - I397

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Android Programs Day 5

Learn about Android Content Providers and SQLite

ELET4133: Embedded Systems. Topic 15 Sensors

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

Vienos veiklos būsena. Theory

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

Our First Android Application

COMP4521 EMBEDDED SYSTEMS SOFTWARE

Android Basics. Android UI Architecture. Android UI 1

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location.

Android Beginners Workshop

Upon completion of the second part of the lab the students will have:

M.A.D Assignment # 1

Android Workshop: Model View Controller ( MVC):

Topics of Discussion

else if(rb2.ischecked()) {

StoppUhr. <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="start1"

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners

Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time


Creating a Custom ListView

Android/Java Lightning Tutorial JULY 30, 2018

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Android Application Development

Programming with Android: Introduction. Layouts. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Android UI Development

Chapter 5 Flashing Neon FrameLayout

Android Application Development. By : Shibaji Debnath

Time Picker trong Android

Practical 1.ListView example

Computer Science E-76 Building Mobile Applications

CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu

Android - Widgets Tutorial

Solving an Android Threading Problem

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

Lecture 14. Android Application Development

Fragments. Lecture 10

Android CardView Tutorial

Screen Slides. The Android Studio wizard adds a TextView to the fragment1.xml layout file and the necessary code to Fragment1.java.

Simple Currency Converter

Android HelloWorld - Example. Tushar B. Kute,

Data Persistence. Chapter 10

android:orientation="horizontal" android:layout_margintop="30dp"> <Button android:text="button2"

<uses-permission android:name="android.permission.internet" />

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

使用 TensorFlow 設計矩陣乘法計算並轉移執行在 Android 上 建國科技大學資管系 饒瑞佶 2017/8

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial

05. RecyclerView and Styles

EMBEDDED SYSTEMS PROGRAMMING Android NDK

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

Android Data Storage

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling

Mobile Programming Lecture 1. Getting Started

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

ANDROID PROGRAMS DAY 3

Tabel mysql. Kode di PHP. Config.php. Service.php

THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed.

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial

Transcription:

EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI Specification: Approaches

UIS: APPROACHES Programmatic approach: UI elements are created inside the application code Declarative approach: UI elements are listed in a data structure that is external to the code, albeit linked to it in some way. The data structure can be usually accessed with a visual editor A mixed approach is possible

PROGRAMMATIC APPROACH: PROS AND CONS Flexibility UI can be built at run time Not clear where/what to change to modify the UI Modifications imply recompilation Difficult to support multiple languages and/or multiple screen sizes

DECLARATIVE APPROACH: PROS AND CONS Better design: the presentation of the application is well separated from the code that controls its behavior Modifications concentrated in one point. And no need to recompile! Easy to support multiple languages and/or multiple screen sizes Bottom line: go declarative

DECLARATIVE APPROACH: ANDROID UI data stored in XML files The XML vocabulary corresponds to the names of the View class/methods and its subclasses/methods 1.Write the XML code 2.The XML is compiled into a resource 3.Load the resource from your Java code

DECLARATIVE HELLOWITHBUTTON (1/4) Project file app/src/main/res/layout/ activity_hello_with_button.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="it.unipd.dei.esp1516.hellowithbuttond.hellowithbutton"> <Button android:id="@+id/bu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pressme" /> <TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pressplease" /> </LinearLayout>

DECLARATIVE HELLOWITHBUTTON (2/4) Project file app/src/main/res/values/strings.xml <resources> <string name="app_name">hellowithbuttond</string> <string name="pressme">press me</string> <string name="pressplease">press the button, please</string> <string name="goodjob">good job!</string> </resources>

DECLARATIVE HELLOWITHBUTTON (3/4) Source file app/src/main/java/it/unipd/ dei/esp1516/hellowithbuttond/hellowith Button.java (1/2) package it.unipd.dei.esp1516.hellowithbuttond; import android.os.bundle; import android.app.activity; import android.view.view; import android.widget.button; import android.widget.textview; public class HelloWithButton extends Activity { /** Called when the activity is first created. */ @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // Display the layout setcontentview(r.layout.activity_hello_with_button);

DECLARATIVE HELLOWITHBUTTON (4/4) Source file app/src/main/java/it/unipd/ dei/esp1516/hellowithbuttond/hellowith Button.java (2/2) } } // Get references to the TextView and the button. // Do it AFTER setcontentview()! Before setcontentview() // the objects have not been instantiated yet final TextView tv = (TextView)findViewById(R.id.tv); Button bu = (Button)findViewById(R.id.bu); // Set the action to be performed when the button is pressed bu.setonclicklistener ( new View.OnClickListener() { public void onclick(view v) { // Perform action on click tv.settext(getstring(r.string.goodjob)); } } );

ANDROID: IDE SUPPORT (1/3) Visual editing of the XML layout file

ANDROID: IDE SUPPORT (2/3) Visual editing of strings.xml

ANDROID: IDE SUPPORT (3/3) Fragment of autogenerated R.java source file package it.unipd.dei.esp1516.hellowithbuttond; public final class R { public static final class id { public static final int bu=0x7f0c0050; public static final int tv=0x7f0c0051; } public static final class layout { public static final int activity_hello_with_button=0x7f040019; } } public static final class string { public static final int app_name=0x7f060014; public static final int goodjob=0x7f060015; public static final int pressme=0x7f060016; public static final int pressplease=0x7f060017; }

DECLARATIVE APPROACH: IOS UI data stored in XIB files or Storyboard files. Such files contain XML code but are not easy to read Objective-C code can refer to programmatically-defined UI objects via special instance variables called outlets. UI objects can invoke Objective-C code via special methods called actions 1.Create the UI with Interface Builder (inside Xcode) 2.Create outlets and actions in the source code 3.Establish the connections with Interface Builder

DECLARATIVE APPROACH: WINDOWS PHONE (1/2) Let us consider XAML applications Each page is associated with one.xaml file that specifies the visual appearance of the page, one code-behind file (written in C# or VB) that specifies the control logic of the page

DECLARATIVE APPROACH: WINDOWS PHONE (2/2) Visual Studio allows to specify connections between UI events and methods in the code-behind file

LAST MODIFIED: MARCH 20, 2017 COPYRIGHT HOLDER: CARLO FANTOZZI (FANTOZZI@DEI.UNIPD.IT) LICENSE: CREATIVE COMMONS ATTRIBUTION SHARE-ALIKE 3.0