Lists and Adapters
Lists in Android
In a "traditional" development framework, you might be able to create and display a
list of items by putting a list component on the screen, and then adding items to the
list doing something like myList.add( "Item" ).
; Breadth-first search
; Assumes you have defined
; 1. A set of operators as lisp functions
; 2. a function solution-state?(description) to determine if a state is a
; UTILITIES TO MEASURE SIZE OF SEARCH SPACE
CSE2AIF - Artificial Intelligence Fundamentals
2015 Individual Assignment 2
Due Friday 9 October 2015, 10:00am
This assignment is to be done individually, and contributes 20% of your final mark for this subject. The
submission date for
; -*- Mode: Lisp; -*; The Missionaries and Cannibals Domain
(:include problem (initial-state (make-cannibal-state)
"The problem is to move M missionaries and C cannibals from one side
of a river to another, using B boats th
CSE2AIF Artificial Intelligence Fundamentals
Exam Information and Preparation Advice
Examination date and time: Check the following URL for the official exam details:
3 hours writing ti
Parsing with Features
The chart parsing algorithm can be extended to handle context free
grammars augmented with features.
Consider the rule
NP(agr(?a) DET(agr(?a) N(agr(?a)
with the phrases a man and a men. Such a rule is called an augmented
Simple Grammar Using Features
VP(vform(inf) will be abbreviated VP[inf].
In this grammar, subcat and vform features for verbs are used extensively.
V(subcat(np_vp:inf) as V[np_vp:inf].
Grammar 4.7 of Allen
A feature is a piece of information associated with a word or phrase. The
info can be syntactic or semantic.
An example feature is agreement: a man is OK but a men is not.
Agreement can be enforced by attaching to nouns and articles a feature tha
Customizing List Items
While it's often fine to have a single line of text for each item in your AdapterView,
sometimes it's nice to put more than a string of information in there.
To do this, you can create your own Adapter. The simplest approach is to s
Fragments in Layouts
There are two ways to include a Fr agment in your application. The first of these
ways is by including them in a Layout.
Including a Fragment in a layout is relatively trivial. All you need to do is use
the <fragment /> element, inclu
In the same way that you can make a reference to a resource in XML to
include it in a layout (like using a string in a TextView or a drawable in an
ImageView), you can actually make a reference to a resource when you
Host Activity and Context
Fragments don't have their own Context. This happens to be one of the
reasons that you need to pass in the parent ViewGroup when you inflate a
Fragment's layout, as the parent ViewGroup can provide Context (and by
proxy, the appr
Data (or Type) Tests
An IntentFilter element can have any number of Data tests, including none.
If an Intent has specified a Type or Data associated with it (this is done by calling
intent.setType(), intent.setData(), or intent.setTypeAndData(), the type
There is one other alternative method to solving this problem, and that is
doing a manual check on an Intent before you launch it, to see if anything can
handle it. This can be done with the Package Manager.
What is a Fragment?
By now you should have a reasonable understanding of the relationship between
Activities and Layouts (to summarise, the Layout is the user interface definition, and
the Activity contains the code and interaction logic).