Application Development for mobile Devices

Slides:



Advertisements
Similar presentations
Rajab Davudov. What is a Layout ? A type of resource that defines what is drawn on the screen. A type of View class whose primary purpose is to organize.
Advertisements

Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
CE881: Mobile and Social Application Programming Simon M. Lucas Layouts.
Android User Interface
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.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Who Am I And Why Am I Here I’m professor Stephen Fickas in CIS – you can call me Steve. I have a research group that works with mobile devices (since 1995!)
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Android Form Elements. Views Provide common UI functionality Form elements: text area, button, radio button, checkbox, dropdown list, etc. Date and time.
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,
CS378 - Mobile Computing User Interface Basics MIKE!! LOOK HERE FOR intercepting the ListView items:
Android: Layouts David Meredith
Custom Views, Drawing, Styles, Themes, ViewProperties, Animations, oh my!
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Android Development: Application Layout Richard S. Stansbury 2015.
Introducing the Sudoku Example
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Modify Android Objects Using.
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
PROG Mobile Java Application Development PROG Mobile Java Application Development Developing Android Apps: Components & Layout.
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Layouts. Layouts Define the user interface for an activity Layouts are defined in.xml files – within /res/layout folder – different layout can.
ANDROID – INTERFACE AND LAYOUT L. Grewe. Interfaces: Two Alternatives Code or XML  You have two ways you can create the interface(s) of your Application.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
Android Fundamentals and Components Kris Secor Mobile Application Development.
Linear Layout, Screen Support, and Events. Linear Layout Supports 2 orientations: 1.Horizontal 2.Vertical I often get confused with how each orientation.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Using Android XML Resources.
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
Programming with Android: Layouts, Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
User Interfaces: Part 1 (View Groups and Layouts).
Presented By: Muhammad Tariq Software Engineer Android Training course.
Copyright© Jeffrey Jongko, Ateneo de Manila University Basic Views and Layouts.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Android App Basics Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5.
MOBILE COMPUTING D10K-7D02 MC04: Layouts Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
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
BUILDING A SIMPLE USER INTERFACE. In this lesson, you create a layout in XML that includes a text field and a button. In the next lesson, your app responds.
Http :// developer. android. com / guide / topics / fundamentals. html.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
You have to remember that  To create an AVD(Android Virtual Device)  The Structure of Android Project  XML Layout  The advantage of XML Layout  Android.
Android Fundamentals. What is Android Software stack for mobile devices Software stack for mobile devices SDK provides tools and APIs to develop apps.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Open Handset Alliance.
Mobile Software Development for Android - I397
Linear Layout, Screen Support, and Events
Mobile Application Development Chapter 3 [Using Eclipse Android Studio for Android Development] IT448-Fall 2017 IT448- Fall2017.
Android Basic XML Layouts
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
HNDIT2417 Mobile Application Development
CIS 470 Mobile App Development
Android Layout Basics Topics
Lecture 2 b: Android Layout Basics Topics
Mobile Computing With Android ACST 4550 Android Layouts
Building User Interfaces Basic Applications
Note Q) How to format code in Enclipse? A) Ctrl + i
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Korea Software HRD Center
Building a Simple User Interface
Mobile Programmming Dr. Mohsin Ali Memon.
CS 240 – Advanced Programming Concepts
Android Sensor Programming
Presentation transcript:

Application Development for mobile Devices Know The Interface Application Development for mobile Devices

Interface Activity displays userinterface of your application which contains widgets like buttons ,textboxes and labels

Interface We define UI in xml file(reslayoutmain.xml) During the runtime we load this UI to OnCreate() eventHandler in the Activity class , During the compilation ,each element in the xml file is compiled into its equivalent Android GUI class ,with attributes represented by methods

Views and ViewsGroups An activity contains views and views groups,a view is a widget that has appearance on the screen,example of views are buttons,labels and textboxes views derives from android.view.Views One or more views can be grouped into the viewGroup.A view group is a layout in which you can order and sequence of views(androidviewViewGroup)

ViewGroup linearLayout AbsoluteLayout RelativeLayout TableLayout FrameLayout ScrollView

Attributes used in view and viewGroups

Units of measurement

Difference between dp and px The dp unit is density independent and 160dp is equivalent to one inch. The px unit corresponds to an actual pixel on screen. You should always use the dp unit because it enables your activity to scale properly when run on devices of varying screen size.

emulator (320*480) emulator wit (480*800)

android:layout_width=”105dp” android:layout_height=”wrap_content” <?xml version=”1.0” encoding=”utf-8”?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > <TextView android:layout_width=”105dp” android:layout_height=”wrap_content” android:text=”@string/hello” /> <Button android:layout_width=”160dp” android:text=”Button” android:layout_gravity=”right” android:layout_weight=”0.2” <EditText android:textSize=”18sp” android:layout_weight=”0.8” </LinearLayout>

layout_height and layout_width Defines how much space this widget is asking from its parent layout to display itself. Although you could enter a value in pixels, inches, or something similar, that is not a good practice. Since your application could run on many different devices with various screen sizes, you want to use relative size for your components, not absolute. So, best practice would be to use either fill_parent or wrap_content for the value. fill_parent means that your widget wants all the available space from its parent. wrap_content means that it requires only as much space as it needs to display its own content. Note that in API Level 8 and higher, fill_parent has been renamed to match_parent.

layout_weihgt Layout weight is a number between 0 and 1. It implies the weight of our layout requirements. For example, if our Status EditText had a default layout weight of 0 and required a layout height of fill_parent, then the Update button would be pushed out of the screen because Status and its request for space came before the button. However, when we set the Status widget’s layout weight to 1, we are saying we want all available space height-wise, but are yielding to any other widget that also may need space, such as the Update button.

Layout_gravity Specifies how this particular widget is positioned within its layout, both horizontally and vertically. Values could be top, center, left, and so on. Notice the difference between this property and gravity, explained next. For example, if you have a widget that has its width set to fill_parent, trying to center it wouldn’t do much, because it’s already taking all available space. However, if our Title Text View had its width set to wrap_content, centering it with layout_gravity would generate the desired results.

gravity Specifies how the content of this widget is positioned within the widget itself. It is commonly confused with layout_gravity. Which one to use will depend on the size of your widget and the desired look. For example, if our Title TextView had the width fill_parent, then centering it with gravity would work, but centeringit with layout_gravity wouldn’t do anything.

Absolute_layout It enables you to specify the exact location of its children. Why do we not use Abslute_layout With the advent of devices with different screen sizes, using the AbsoluteLayout makes it difficult for your application to have a consistent look and feel across devices.

TableLayout The TableLayout groups views into rows and columns. You use the <TableRow> element to designate a row in the table. Each row can contain one or more views. Each view you place within a row forms a cell. The width of each column is determined by the largest width of each cell in that column.

Table Layout <?xml version=”1.0” encoding=”utf-8”?> xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_height=”fill_parent” android:layout_width=”fill_parent” > <TableRow> <TextView android:text=”User Name:” android:width =”120px” /> <EditText android:id=”@+id/txtUserName” android:width=”200px” /> </TableRow> android:text=”Password:” android:id=”@+id/txtPassword” android:password=”true” <TextView /> <CheckBox android:id=”@+id/chkRememberPassword” android:layout_height=”wrap_content” android:text=”Remember Password” <Button android:id=”@+id/buttonSignIn” android:text=”Log In” /> </TableLayout>

Relative layout The RelativeLayout enables you to specify how child views are positioned relative to each other.

(activity8)Listening for UI notifications User interact with UI at two levels Activity level Views level At activity level Activity class exposes methods that you can override.. onKeyDown()---Called when a key was pressed and not handled by any of the views contained with in the acitvity onKeyUp()--- onMenuItemSelected()— onMenuOpened()----

When to use “@android or ?android” The @-syntax is used for resources that are defined in your project or the Android framework. The ?-syntax is used for resources in the current theme. For starStyle, which should be defined in the theme "?android:attr/starStyle"