View
219
Download
1
Category
Tags:
Preview:
Citation preview
Bruce Scharlau, University of Aberdeen, 2009
Android has many components
Bluetooth and USB drivers now gone from kernelXMPP gone from application framework
Views are tied to activities (screens) in Android
One class per activity, and screen, which may be done as xml file
One layout per activity (class)
main.xml goes with AuctionStart
list.xml goes with ListItems
hit_server.xml goes with HitServer
Xml layout inflated in onCreate
Set value of inflated objectSet value of inflated object
INCOMPLETE CODEINCOMPLETE CODE
New view items and attached to xml valuesNew view items and attached to xml values
Android emulator runs as ‘localhost’, ie ‘loopback’
Emulator is at 127.0.0.1 so need to call service at IP address of service to test network apps on developer machine
Apps move through states during lifecycle
onPause is last state to preserve state and cleanup before app possibly destroyed
Handler class provides access to running thread for main UI
Handler has Looper which contains MessageQueue that can be called and return objects to UI thread
Method returns string from network
Bruce Scharlau, University of Aberdeen, 2009
Log output for debugging, etc
Simple method to call URL and return value
Might need robust calls to network
Put heavy lifting work in HTTPRequestHelper so accessible to other classes
Handler waits for message and then returns
Recommended