Android Introduction Hello Views Part 2.

Slides:



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

Basic Functionality in Android. Functionality in Android Events in Java – mouse related mouse clicked button down or up mouse entered – many others key.
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!)
@2010 Mihail L. Sichitiu1 Android Introduction Hello Views Part 2.
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.
1 Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources, Listener 10/9/2012 Y. Richard Yang.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling.
Wireless Mobility with Android 1 Presented by: Ung Yean MS. Computer Science American University, Washington DC, USA.
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.
@2011 Mihail L. Sichitiu1 Android Introduction GUI Menu Many thanks to Jun Bum Lim for his help with this tutorial.
1/29/ Android Programming: FrameLayout By Dr. Ramji M. Makwana Professor and Head, Computer Engineering Department A.D. Patel.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
Programming with Android: Layouts, Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Networking: Part 1 (Web Content). Networking with Android Android provides A full-featured web browser based on Chromium, the open source browser engine.
Import import android.graphics.Bitmap; import android.widget.ImageView;
Copyright© Jeffrey Jongko, Ateneo de Manila University Basic Views and Layouts.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
User Interface Android Club Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView.
Android Boot Camp Demo Application – Part 1. Development Environment Set Up Download and install Java Development Kit (JDK) Download and unzip Android.
Handling View Events. Open the *MainActivity.java* which is the Activity that hosts the layout in "activity_main.xml". The setContentView method inside.
Android Using Menus Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright © CommonsWare, LLC. ISBN:
Video Games list lab 6  At the end of this lab you will be expected to know:  What Views, View Groups, Layouts, and Widgets are and how they relate to.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
Android Application Lifecycle and Menus
Designing user interfaces using: Simple views 1. Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton.
GUI Components 1 Fall 2012 CS2302: Programming Principles.
Android and s Ken Nguyen Clayton state University 2012.
CHAP 6. 이벤트 처리. © 2012 생능출판사 All rights reserved 폴링과 이벤트 구동 방식.
Contents Searches related to Android RatingBar Basics Android ratingbar example Android custom ratingbar.
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Cosc 5/4730 Support design library. Support Design library Adds (API 9+) back support to a number of 5.0 lollipop widgets and material design pieces –
Android Programming - Features
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Introduction Hello World
Android N Amanquah.
several communicating screens
Adapting to Display Orientation
CS240: Advanced Programming Concepts
GUI Programming Fundamentals
Android – Event Handling
Android Introduction Hello World.
Android Widgets 1 7 August 2018
CS499 – Mobile Application Development
Android Introduction Hello Views Part 1.
ITEC535 – Mobile Programming
Android – Read/Write to External Storage
Mobile Software Development Framework: Android
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Android Sensor Programming
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
Android Developer Fundamentals V2
滑動 建國科技大學 資管系 饒瑞佶.
Programski jezici za mobilne aplikacije
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Adding Components to Activity
BLP 4216 MOBİL UYGULAMA GELİŞTİRME-2
CMPE419 Mobile Application Development
Lasalle-App Tecnología Móvil.
Android Sensor Programming
Android Sensor Programming
Android Sensor Programming
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Android Introduction Hello Views Part 2

Hello Form Stuff Custom Buttons Edit Text Check Boxes Radio Boxes Toggle Button Rating Bar

Custom Button <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:drawable="@drawable/android_pressed"           android:state_pressed="true" />     <item android:drawable="@drawable/android_focused"           android:state_focused="true" />     <item android:drawable="@drawable/android_normal" /> </selector>     <Button         android:id="@+id/button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:padding="10dp"         android:background="@drawable/android_button" /> final Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() {     public void onClick(View v) {         // Perform action on clicks         Toast.makeText(HelloFormStuff.this, "Beep Bop", Toast.LENGTH_SHORT).show();     } });

Edit Text     <EditText         android:id="@+id/edittext"         android:layout_width="fill_parent"         android:layout_height="wrap_content"/> final EditText edittext = (EditText) findViewById(R.id.edittext); edittext.setOnKeyListener(new OnKeyListener() {     public boolean onKey(View v, int keyCode, KeyEvent event) {         // If the event is a key-down event on the "enter" button         if ((event.getAction() == KeyEvent.ACTION_DOWN) &&             (KeyEvent.KEYCODE_ENTER)) {           // Perform action keyCode == on key press           Toast.makeText(HelloFormStuff.this, edittext.getText(), Toast.LENGTH_SHORT).show();           return true;         }         return false;     } });

Check Box <CheckBox android:id="@+id/checkbox"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="check it out" /> final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox); checkbox.setOnClickListener(new OnClickListener() {     public void onClick(View v) {         // Perform action on clicks, depending on whether it's now checked         if (((CheckBox) v).isChecked()) {             Toast.makeText(HelloFormStuff.this, "Selected", Toast.LENGTH_SHORT).show();         } else {             Toast.makeText(HelloFormStuff.this, "Not selected", Toast.LENGTH_SHORT).show();         }     } });

Radio Button     <RadioGroup       android:layout_width="fill_parent"       android:layout_height="wrap_content"       android:orientation="vertical">       <RadioButton android:id="@+id/radio_red"           android:layout_width="wrap_content"           android:layout_height="wrap_content"           android:text="Red" />       <RadioButton android:id="@+id/radio_blue"           android:layout_width="wrap_content"           android:layout_height="wrap_content"           android:text="Blue" />     </RadioGroup> private OnClickListener radio_listener = new OnClickListener() {     public void onClick(View v) {         // Perform action on clicks         RadioButton rb = (RadioButton) v;         Toast.makeText(HelloFormStuff.this, rb.getText(), Toast.LENGTH_SHORT).show();     } }; final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red);   final RadioButton radio_blue = (RadioButton) findViewById(R.id.radio_blue);   radio_red.setOnClickListener(radio_listener);   radio_blue.setOnClickListener(radio_listener);

Toggle Button     <ToggleButton android:id="@+id/togglebutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textOn="Vibrate on"         android:textOff="Vibrate off"/> final ToggleButton togglebutton = (ToggleButton) findViewById(R.id.togglebutton); togglebutton.setOnClickListener(new OnClickListener() {     public void onClick(View v) {         // Perform action on clicks         if (togglebutton.isChecked()) {             Toast.makeText(HelloFormStuff.this, "Checked", Toast.LENGTH_SHORT).show();         } else {             Toast.makeText(HelloFormStuff.this, "Not checked", Toast.LENGTH_SHORT).show();         }     } });

Rating Bar     <RatingBar android:id="@+id/ratingbar"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:numStars="5"         android:stepSize="1.0"/> final RatingBar ratingbar = (RatingBar) findViewById(R.id.ratingbar); ratingbar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {     public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {         Toast.makeText(HelloFormStuff.this, "New Rating: " + rating, Toast.LENGTH_SHORT).show();     } });

Hello WebView Making a window for viewing web pages

/res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> <WebView  xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/webview"     android:layout_width="fill_parent"     android:layout_height="fill_parent" />

OnCreate( ) WebView mWebView; public void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.main);     mWebView = (WebView) findViewById(R.id.webview);     mWebView.getSettings().setJavaScriptEnabled(true);     mWebView.loadUrl("http://www.google.com"); }

AndroidManifest <uses-permission android:name="android.permission.INTERNET" /> <activity android:name=".HelloWebView" android:label="@string/app_name"      android:theme="@android:style/Theme.NoTitleBar">

Run it!

For the MapView Generate an API Key Thank you for signing up for an Android Maps API key! Your key is: 0sfwSFw1BU4WGRreaBYtss4jGuPccZhhq7WDOCg This key is good for all apps signed with your certificate whose fingerprint is: D6:0A:9A:E8:24:D1:D7:8C:F5:68:20:7D:67:40:3A:01 Here is an example xml layout to get you started: <com.google.android.maps.MapView android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="0sfwSFw1BU4WGRreaBYtss4jGuPccZhhq7WDOCg" />