Android UI, and Networking Can do most networking on Android Bluetooth only on 2.0, Not supported with version 1.6 Android has many components Bluetooth and USB drivers now gone from kernel Bruce Scharlau, University of Aberdeen, 2009 XMPP gone from application framework All layouts are hierarchical All screens are derived from view Hierarchical views can include similar groups Children do as told in Android TextView is child of parent viewgroup and fills, or wraps content There are many types of controls in Android Lists can be handled via adapters and filled from xml file of values Table layout allows for just that with data Use the hierarchy viewer tool to optimize and debug interface 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 file details components Hierarchy of views as noted earlier Xml layout inflated in onCreate New view items and attached to xml values Set value of inflated object INCOMPLETE CODE 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 Activity is one thing you can do Bruce Scharlau, University of Aberdeen, 2009 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 Handler puts thread response into UI thread Method returns string from network Log output for debugging, etc Bruce Scharlau, University of Aberdeen, Simple method to call URL2009 and return value Might need robust calls to network Handler waits for message and then returns Put heavy lifting work in HTTPRequestHelper so accessible to other classes Parse xml response and populate Java bean instance Bruce Scharlau, University of Aberdeen, 2009 Add permissions to manifest for connection and network Bruce Scharlau, University of Aberdeen, 2009 End of Lecture