ANDROID LISTS.

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

 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
@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.
Presenting Lists of Data. Lists of Data Issues involved – unknown number of elements – allowing the user to scroll Data sources – most common ArrayList.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
Content providers Accessing shared data in a uniform way 1Content providers.
Mobile Application Development using Android Lecture 2.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
JQuery UI. Slide 2 Introduction From the jQuery UI Home Page jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built.
Mobile Computing Lecture#11 Adapters and Dialogs.
ListView.
Create Navigation Drawer Team 2 Zhong Wang Jiaming Dong Philip Wu Lingduo Kong.
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.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
User Interfaces: Part 1 (View Groups and Layouts).
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.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Creating multiple views Introduction to intents Passing data to.
datasourc e + itemRenderer + layout Storag e Data Source.
ListView and ExpandableListView
Recap of Part 1 Terminology Windows FormsAndroidMVP FormActivityView? ControlViewView? ?ServiceModel? Activities Views / ViewGroups Intents Services.
Adapters 1 CS440. Adapters (again!)  Adapters are bridging classes, that bind data to user-interface Views. The adapter is responsible for creating the.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
Building User Interfaces Basic Applications
© 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.
Address Book App 1 Fall 2014 CS7020: Game Design and Development.
David Sutton USING CONTENT PROVIDERS. TOPICS COVERED THIS WEEK  Persistence  Introduction to databases  Content providers  Cursors  Cursor adapters.
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.
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.
UI Redux, Navigation Patterns, Tabbed Views, Pagers, Drawers
Android 9: Layouts Kirk Scott.
Android Mobile Applications Course Introduction
Mobile Applications (Android Programming)
Mobile Application Development BSCS-7 Lecture # 9
Creating LOVs and Editors
Android – Event Handling
ListView: Part 2.
Android Application SQLite 1.
JQuery UI.
Customizaiton of Layouts
Android Development: Advanced Widgets using Adapters
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Android Introduction Hello Views Part 1.
ITEC535 – Mobile Programming
WordMap Group 8 上海交通大学 电子信息与电气工程学院 Group leader: Hao Xia 夏昊.
Reactive Android Development
Un</br>able’s MySecretSecrets
Android Programming Lecture 6
Android ListView Demo.
Java for Teachers Intermediate
Android Lists and Fragments
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
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.
Mobile Programming Dr. Mohsin Ali Memon.
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

ANDROID LISTS

Android Lists (Introduction) Items can be placed in a list from which the user can scroll through the items The selection of a list item might (and often does) start another activity or fragment Or display detail data Adapters manage the data model We connect the list to an array or other data type

Adapter Pattern Adapters are just another design pattern The adapter design pattern makes incompatible things compatible Adapters are structural patterns Intent: Convert the interface of a class into another one Wrap a class with a new interface http://sourcemaking.com/design_patterns/adapter

Arrays as Resources We can create array resources <string-array> is an array of strings <integer-array> is an array of integers

Arrays as Resources (Example)

Reading an Array Resource Remember that getResources() is used to get a resource getStringArray() gets a string resource array getIntArray() gets an integer resource array http://developer.android.com/reference/android/content/res/Resources.html

Reading an Array Resource (Example) Get the string array named adobe_products and store the result in the String array variable adobe_products Use R.array.array_name String[] adobe_products = getResources().getStringArray( R.array.adobe_products);

Creating the ArrayAdapter (1) The constructor we will use accepts 4 arguments: The first contains a reference to the current context (this) The second contains the resource ID for a layout (R.layout.list_item) The third contains the id of the TextView within the layout to be populated The last contains the array of objects

Creating the ArrayAdapter (2)

Working with the Lists (Method 1) Derive an Activity from ListActivity Use this method when implementing a full screen list ListActivity manages the complexities of the list itself Such as providing a default full screen layout It’s possible to create a custom layout though

Working with the Lists (Method 2) The ListView widget is used when you need a custom screen layout There are requirements The layout MUST contain a ListView object

Working With Lists (Method 1)

The ListView (Introduction) The ListView is a view group that displays a list of scrollable items The ExpandableListView class supports a grouping of items Items are added using an adapter that pulls content from a source (commonly called the data model) An array (ArrayAdapter) Or database query (CursorAdapter)

Referencing the ListView The getListView method applies to the ListActivity class. It gets the activity’s ListView widget The control is built-in to ListActivity

Wiring onItemClick The ListView has an OnItemClickListener

Wiring onItemClick (Example)

Implementing the ListView In the layout file, you need to create the ListView itself

Implementing the ListView Next, wire he ListView to the Adapter Note here we are using an inline array rather than a resource