User Interface Android Club 2015. Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView.

Slides:



Advertisements
Similar presentations
Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Advertisements

@2011 Mihail L. Sichitiu1 Android Introduction Hello Socket Programming TCP and UDP.
@2010 Mihail L. Sichitiu1 Android Introduction Hello Views Part 2.
@2011 Mihail L. Sichitiu1 Android Introduction Hello Views Part 1.
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
Android Development (Basics)
App Development on Android. Contents  First Milestone  Second Milestone  Third Milestone  Last Milestone 
CS378 - Mobile Computing User Interface Basics MIKE!! LOOK HERE FOR intercepting the ListView items:
ANDROID UI - DEVELOP AND DESIGN Peter Liu School of ICT, Seneca College.
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.
Getting Started with Android APIs Ivan Wong. Motivation - “Datasheet” - Recently exposed to what’s available in Android - So let’s see what API’s are.
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.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Chapter 2: Simplify! The Android User Interface
Chapter 5 Creating User Interfaces GOALS and OBJECTIVES Begin our application by creating our user interface. More than one way to create a user interface.
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.
Mobile Computing Lecture#11 Adapters and Dialogs.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Create Navigation Drawer Team 2 Zhong Wang Jiaming Dong Philip Wu Lingduo Kong.
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.
Presented By: Muhammad Tariq Software Engineer Android Training course.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Field Trip #32 Digital Alarm Clock By Keith Lynn.
Import import android.graphics.Bitmap; import android.widget.ImageView;
User notification Android Club Agenda Toast Custom Toast Notification Dialog.
Copyright© Jeffrey Jongko, Ateneo de Manila University Basic Views and Layouts.
Activity Android Club Agenda Hello Android application Application components Activity StartActivity.
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.
Applications with Multiple Activities. Most applications will have more than one activity. The main activity is started when the application is started.
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.
Mobile Programming Lecture 7 Dialogs, Menus, and SharedPreferences.
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
ListView and ExpandableListView
Activities and Intents Richard S. Stansbury 2015.
Designing user interfaces using: Simple views 1. Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton.
Fragment Android Club Agenda Fragment Static fragment Dynamic fragment ViewPager.
User Interface Layout Interaction. EventsEvent Handlers/Listeners Interacting with a user.
Events. Slide 2©SoftMoore Consulting Events Events are generated when a user interacts with the view objects of an application. Examples –button clicked–
Contents Searches related to Android RatingBar Basics Android ratingbar example Android custom ratingbar.
Field Trip #30 A Memory Game By Keith Lynn. View A View is the basic building block of an app Some Views hold other views An example of this is GridLayout.
Mobile Programming Lecture 4 Resources, Selection, Activities, Intents.
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.
Java for android Development Nasrullah Khan. Using instanceof in Android Development the classes such as Button, TextView, and CheckBox, which represent.
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 –
Chapter 2: Simplify! The Android User Interface
CS499 – Mobile Application Development
Mobile Application Development BSCS-7 Lecture # 9
Android – Event Handling
Android Widgets 1 7 August 2018
Android 16: Input Events Kirk Scott.
Hello Socket Programming TCP and UDP
Android Introduction Hello Views Part 2.
MultiUni Trần Vũ Tất Bình
Android Sensor Programming
UNIT 08 그림책 만들기 2/2 로봇 SW 콘텐츠 교육원 조용수.
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 Topics Custom ArrayAdapters Creating an Event Listener
Android Developer Fundamentals V2
Android Developer Fundamentals V2
ארועים ומאזינים android.
Mobile Programmming Dr. Mohsin Ali Memon.
User Interface Screen Elements
User Interface Screen Elements
CA16R405 - Mobile Application Development (Theory)
CIS 470 Mobile App Development
Presentation transcript:

User Interface Android Club 2015

Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView

Button: example Button bButton = (Button) findViewById(R.id.bButton); bButton.setOnClickListener(new View.OnClickListener() public void onClick(View v) { Toast.makeText(getApplicationContext(), "Button click", Toast.LENGTH_LONG).show(); } });

Button: practice Add new button to your layout Set OnClickListener OnClick show Toast: “Hello Android!”

OnLongClickListener: example bButton.setOnLongClickListener(new View.OnLongClickListener() public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Button long click", Toast.LENGTH_LONG).show(); return true; } });

OnLongClickListener: practice Set OnClickListener to the previous button you created OnLongClick show Toast: “Heeelloooo Aaaandrooooooiiiiiiiiid!”

ToggleButton: example final ToggleButton tbButton = (ToggleButton) findViewById(R.id.tbButton); tbButton.setOnClickListener(new View.OnClickListener() public void onClick(View v) { boolean checked = tbButton.isChecked(); if (checked) { tbButton.setText("Turned on"); } else { tbButton.setText("Turned off"); } } });

ToggleButton: practice Put ToggleButton Set onClickListener OnClick check isChecked or not If checked show text: Music is playing =) If not: Music is stopped =(

CheckBox: example final CheckBox cbPizza = (CheckBox) findViewById(R.id.cbPizza); cbPizza.setOnClickListener(new View.OnClickListener() public void onClick(View v) { boolean checked = cbPizza.isChecked(); if (checked) { Toast.makeText(getApplicationContext(),"Pizza with cheese", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(),"Pizza without cheese", Toast.LENGTH_LONG).show(); } } });

CheckBox: practice Add CheckBox: Do you want to go to party? Set onClickListener If checked Toast: You go to party If not Toast: You do not go to party

RatingBar: example RatingBar rbPizza = (RatingBar) findViewById(R.id.rbPizza); rbPizza.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { Toast.makeText(getApplicationContext(), "Pizza rating:"+rating, Toast.LENGTH_LONG).show(); } });

RatingBar: practice Create new RatingBar On rating change: Show Toast Example: “Party rating: 3”

AutoCompleteTextView: example AutoCompleteTextView actvStudents = (AutoCompleteTextView) findViewById(R.id.actvStudents); String[] students = {"Amirsaidkhon", "Nurislom", "Evgeniy","Kudrat","Yusuf","Samuil","Munis a","Nargiza","Ravshan"}; ArrayAdapter adapter = new ArrayAdapter (this,android.R.layout.sim ple_list_item_1,students); actvStudents.setAdapter(adapter);

AutoCompleteTextView: practice Create AutoComplete TextView Create cities String array Create ArrayAdapter Set adapter to AutoCompleteTextView

Hide/show view: example final ToggleButton tbRatingVisible = (ToggleButton) findViewById(R.id.tbRatingVisible); tbRatingVisible.setOnClickListener(new View.OnClickListener() public void onClick(View v) { boolean checked = tbRatingVisible.isChecked(); if (checked) { rbPizza.setVisibility(View.VISIBLE); tbRatingVisible.setText("Rating is visible"); } else { rbPizza.setVisibility(View.INVISIBLE); tbRatingVisible.setText("Rating is not visible"); } } });

Hide/show: practice Create another ToggleButton Set on click listener OnClick: show/hide AutoCompleteTextView

Qeustions? Any questions?