Download presentation
Presentation is loading. Please wait.
Published byCandace McGee Modified over 9 years ago
1
Android UI, and Networking
2
Can do most networking on Android Bluetooth only on 2.0, Not supported with version 1.6
3
Bruce Scharlau, University of Aberdeen, 2009 Android has many components Bluetooth and USB drivers now gone from kernel XMPP gone from application framework
4
All layouts are hierarchical
5
All screens are derived from view
6
Hierarchical views can include similar groups
7
Children do as told in Android TextView is child of parent viewgroup and fills, or wraps content
8
There are many types of controls in Android
9
Lists can be handled via adapters and filled from xml file of values
10
Table layout allows for just that with data
11
Use the hierarchy viewer tool to optimize and debug interface
12
Views are tied to activities (screens) in Android One class per activity, and screen, which may be done as xml file
13
One layout per activity (class) main.xml goes with AuctionStart list.xml goes with ListItems hit_server.xml goes with HitServer
14
Xml layout file details components Hierarchy of views as noted earlier
15
Xml layout inflated in onCreate Set value of inflated object INCOMPLETE CODE New view items and attached to xml values
16
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
17
Bruce Scharlau, University of Aberdeen, 2009 Activity is one thing you can do
18
Apps move through states during lifecycle onPause is last state to preserve state and cleanup before app possibly destroyed
19
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
20
Handler puts thread response into UI thread
21
Method returns string from network Bruce Scharlau, University of Aberdeen, 2009 Log output for debugging, etc Simple method to call URL and return value
22
Might need robust calls to network Put heavy lifting work in HTTPRequestHelper so accessible to other classes Handler waits for message and then returns
23
Parse xml response and populate Java bean instance Bruce Scharlau, University of Aberdeen, 2009
24
Add permissions to manifest for connection and network Bruce Scharlau, University of Aberdeen, 2009
25
End of Lecture
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.