GUI Programming Fundamentals

Slides:



Advertisements
Similar presentations
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Advertisements

User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
Presenting Lists of Data. Lists of Data Issues involved – unknown number of elements – allowing the user to scroll Data sources – most common ArrayList.
Android development the first app. Andoid vs iOS which is better? Short answer: neither Proponents on both sides For an iOS side, see this article on.
Android Tutorial Team 3 Jerry Yu Mayank Mandava Mu Du Will Wangles.
1 Mobile Computing Monetizing An App Copyright 2014 by Janson Industries.
Package org.androidtown.database.query; import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase;
Mobile Programming Lecture 6
Social Media Apps Programming Min-Yuh Day, Ph.D. Assistant Professor Department of Information Management Tamkang University
Resources and RelativeLayouts. Resources Android Resources We’ve already talked about the different types of Android Resources DirectoryResource Type.
Animation.
1/29/ Android Programming: FrameLayout By Dr. Ramji M. Makwana Professor and Head, Computer Engineering Department A.D. Patel.
Create Navigation Drawer Team 2 Zhong Wang Jiaming Dong Philip Wu Lingduo Kong.
Android - Broadcast Receivers
User Interfaces: Part 1 (View Groups and Layouts).
로봇을 조종하자 3/4 UNIT 17 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 스마트 폰의 센서를 사용할 수 있다. 2.
Import import android.graphics.Bitmap; import android.widget.ImageView;
로봇 모니터링 1/2 UNIT 20 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Message Queue Handler 2.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Android Boot Camp Demo Application – Part 1. Development Environment Set Up Download and install Java Development Kit (JDK) Download and unzip Android.
ANDROID – A FIRST PROGRAM L. Grewe Using AndroidStudio –basic Android  Lets do a “Hello World Project”  Start up AndroidStudio (assume you have installed.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
Android and s Ken Nguyen Clayton state University 2012.
TCS Internal Maps. 2 TCS Internal Objective Objective :  MAPS o Integration of Maps.
Android Alert Dialog. Alert Dialog Place Button to open the dialog. public class MainActivity extends ActionBarActivity { private static Button button_sbm;
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Resources. Android Resources We’ve already talked about the different types of Android Resources DirectoryResource Type anim/XML files that define tween.
Lab7 – Appendix.
Introduction to android
Android Programming - Features
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Introduction Hello World
several communicating screens
CS240: Advanced Programming Concepts
Android – Event Handling
CS499 – Mobile Application Development
Android Introduction Hello World.
Android Widgets 1 7 August 2018
ITEC535 – Mobile Programming
Android – Read/Write to External Storage
תכנות ב android אליהו חלסצ'י.
CIS 470 Mobile App Development
Android Programming Lecture 6
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CMPE419 Mobile Application Development
CA16R405 - Mobile Application Development (Theory)
CMPE419 Mobile Application Development
CMPE419 Mobile Application Development
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
Activities and Intents
Android Developer Fundamentals V2 Lesson 4
CIS 470 Mobile App Development
CIS 470 Mobile App Development
ארועים ומאזינים android.
CMPE419 Mobile Application Development
Adding Components to Activity
CMPE419 Mobile Application Development
BLP 4216 MOBİL UYGULAMA GELİŞTİRME-2
CMPE419 Mobile Application Development
CMPE419 Mobile Application Development
CIS 470 Mobile App Development
Mobile Programming Broadcast Receivers.
Android Sensor Programming
Android Sensor Programming
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

GUI Programming Fundamentals

<LinearLayout xmlns:android="http://schemas. android xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/msg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/up" android:text="@string/up_button" > </Button> android:id="@+id/down" android:text="@string/down_button" android:id="@+id/left" android:text="@string/left_button" android:id="@+id/right" android:text="@string/right_button" </LinearLayout> package com.seetsoft.test; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; public static final class drawable { public static final int ic_launcher=0x7f020000; public static final class id { public static final int action_settings=0x7f080005; public static final int down=0x7f080002; public static final int left=0x7f080003; public static final int msg=0x7f080000; public static final int right=0x7f080004; public static final int up=0x7f080001; public static final class layout { public static final int activity_main=0x7f030000; public static final class menu { public static final int main=0x7f070000; At Build Time, the SDK creates a class that assigns integers to each element.

setContentView(R.layout.activity_main); <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="vertical"> <TextView android:id="@+id/msg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/up" android:text="@string/up_button" > </Button> android:id="@+id/down" android:text="@string/down_button" android:id="@+id/left" android:text="@string/left_button" android:id="@+id/right" android:text="@string/right_button" </LinearLayout> protected void onCreate(Bundle savedInstanceState) { // etc setContentView(R.layout.activity_main); } At Run Time, Activity: setContentView(…) Fragment: View v = inflater.inflate(R.layout.pix_frag_layout, container, false); causes the XML layout file to be parsed GUI objects to be created (inflated)

At Run Time, we access the inflated objects via the Resource class R. public class MainActivity extends Activity implements OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button downButton = (Button)findViewById(R.id.down); downButton.setOnClickListener(new OnClickListener(){ public void onClick(View view){ } }); public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true;

Programming Considerations: We cannot access GUI elements programmatically before they have been rendered. An attempt to do so will typically result in a null pointer exception. We can, however, always access the Resource class R. The id values are created independently of the state of their existence.