Android Development: Advanced Widgets using Adapters

Slides:



Advertisements
Similar presentations
Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
Advertisements

Android Selection Widgets Yuliana Setiowati Rizky Yuniar Hakkun 1Politeknik Elektronika Negeri Surabaya.
Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Unlocking Android Chapter 4.  Understanding activities and views  Exploring the Activity lifecycle  Working with resources  Defining the AndroidManifest.xml.
 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
User Interface Classes.  Design Principles  Views & Layouts  Event Handling  Menus  Dialogs.
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,
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
Presenting Lists of Data. Lists of Data Issues involved – unknown number of elements – allowing the user to scroll Data sources – most common ArrayList.
Android: Layouts David Meredith
Android Development: Application Layout Richard S. Stansbury 2015.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 9: Customize! Navigating with Tabs on a Tablet App.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
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.
Content providers Accessing shared data in a uniform way 1Content providers.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
Mobile Computing Lecture#11 Adapters and Dialogs.
ListView.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 7: Reveal! Displaying Pictures in a GridView.
Address Book App 1. Define styles   Specify a background for a TextView – res/drawable/textview_border.xml.
Chapter 7: Reveal! Displaying Pictures in a Gallery.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Copyright© Jeffrey Jongko, Ateneo de Manila University Custom ListAdapters.
Android Boot Camp Demo Application – Part 1. Development Environment Set Up Download and install Java Development Kit (JDK) Download and unzip Android.
MOBILE COMPUTING D10K-7D02 MC04: Layouts Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Android Development: Basic Widgets Richard S. Stansbury 2015.
DKU-MUST Mobile ICT Education Center 11. AdapterView.
ListView and ExpandableListView
Adapters 1 CS440. Adapters (again!)  Adapters are bridging classes, that bind data to user-interface Views. The adapter is responsible for creating the.
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
More App Customizations. Overview  Application/ Activity Customizations: Themes  Menu Customizations  Custom Dialogs  Custom Toasts  Custom Buttons.
CHAPTER 9 File Storage Shared Preferences SQLite.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
Mobile Programming Lecture 4 Resources, Selection, Activities, Intents.
Http :// developer. android. com / guide / topics / fundamentals. html.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Android 9: Layouts Kirk Scott.
Android Mobile Applications Course Introduction
CS499 – Mobile Application Development
Android Layouts 8 May 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.
several communicating screens
Mobile Application Development BSCS-7 Lecture # 9
Android 9: Layouts Kirk Scott.
Customizaiton of Layouts
ITEC535 – Mobile Programming
Android Programming Lecture 6
Android ListView Demo.
ANDROID LISTS.
Android Lists and Fragments
CMPE419 Mobile Application Development
Building User Interfaces Basic Applications
Android Topics Custom ArrayAdapters
Android Topics Custom ArrayAdapters Creating an Event Listener
Android Topics Limited Resources and why we need to consider them.
HNDIT2417 Mobile Application Development
ListView ? BaseAdapter ?.
Reactive Android Development
CMPE419 Mobile Application Development
ListView A view that shows items in a vertically scrolling list. The items come from the ListAdapter associated with this view. ListAdapter is used to.
CMPE419 Mobile Application Development
User Interface Screen Elements
User Interface Screen Elements
CS 240 – Advanced Programming Concepts
CS 240 – Advanced Programming Concepts
Korea Software HRD Center
Presentation transcript:

Android Development: Advanced Widgets using Adapters Richard S. Stansbury 2015

Adapters ListView Spinner GridView ExpandableListView Gallery These all extend AdapterView http://developer.android.com/reference/android/widget/AdapterView.html

Adapters Adapters store content that are then displayed by the AdapterView classes e.g. ArrayAdapter CursorAdapter ListAdapter SpinnerAdapter

ArrayAdapter ArrayAdapter (Context context, int resource, T [] objects) context – context from which you are building the ArrayAdapter resource – R.id.<identifier> specifies the view that is used to encapsulate the data objects – objects to be displayed toString() is performed on each item in the object array and the appropriate TextView derivative is generated Example: ArrayAdapter a = new ArrayAdapter(this, android.R.Layout.simple_list_item_1, items); http://developer.android.com/reference/android/widget/AdapterView.html

ListView Displays a list of strings List items can be selected or clicked extending ListActivity is an easy approach, but requires a different type of ID XML <ListView android:id = “android:id/list” android:layout_width = “fill_parent” android:layout_height = “wrap_content” >

ListView (continued) Java setAdapter(…) setOnItemSelectedListener(…) Sets the adapter to display setOnItemSelectedListener(…) Sets the listener for when an item is selected setOnItemClickListener(…) Sets the listener for an item being clicked setOnScrollListener(…) Records scroll event getSelectedItem() Returns the object for the currently selected item.

Example How do we specify a list? Ignore the multiple lines per item…this was a default of the layout viewer

ListView: Selection Modes As an alternative to tracking clicks Single selection or multiple selection Java: setChoiceMode(mode) mode = {CHOICE_MODE_SINGLE, CHOICE_MODE_MULTIPLE} XML: android:choiceMode = “multipleChoice” Resource ID: android.R.layout.simple_list_item_single_choice android.R.simple_list_item_multiple_chioce

Example

Spinner A fancy term for a drop down menu i.e. a List View that is initially collapsed and when clicked expands providing a scrollable view of the list <spinner android:id=“@id+/spinner” android:layout_width = “fill_parent” android:layout_height = “fill_parent” />

Spinner (continued) Java setAdapter setOnItemSelectedListener setDropDownViewResource - used to configure the adapter (not spinner)

Example

Example

Challenge Build / Demo Note: cropped from full portrait view to fit on slides.