Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bruce Scharlau, University of Aberdeen, 2010 Android UI, and Networking Mobile Computing Based on android-sdk_2.2 Unless otherwise stated, images are from.

Similar presentations


Presentation on theme: "Bruce Scharlau, University of Aberdeen, 2010 Android UI, and Networking Mobile Computing Based on android-sdk_2.2 Unless otherwise stated, images are from."— Presentation transcript:

1 Bruce Scharlau, University of Aberdeen, 2010 Android UI, and Networking Mobile Computing Based on android-sdk_2.2 Unless otherwise stated, images are from android sdk

2 Proxy issues while in eduroam May need page as intermediary for accessing other services with emulator in Java ME or Android Bruce Scharlau, University of Aberdeen, 2010 PHP/JSP page Desired web service web form can be configured to use proxy

3 Can do most networking on Android Bluetooth only on 2.0 onwards – look at that later. Bruce Scharlau, University of Aberdeen, 2010

4 Android has many components

5 All layouts are hierarchical Bruce Scharlau, University of Aberdeen, 2010

6 All screens are derived from view Bruce Scharlau, University of Aberdeen, 2010 Source: unlocking android, p 71

7 Hierarchical views can include similar groups Bruce Scharlau, University of Aberdeen, 2010

8 Children do as told in Android Bruce Scharlau, University of Aberdeen, 2010 TextView is child of parent viewgroup and fills, or wraps content

9 There are many types of controls in Android Bruce Scharlau, University of Aberdeen, 2010

10 Lists can be handled via adapters and filled from xml file of values Bruce Scharlau, University of Aberdeen, 2010

11 Table layout allows for just that with data Bruce Scharlau, University of Aberdeen, 2010

12 Use the hierarchy viewer tool to optimize and debug interface Bruce Scharlau, University of Aberdeen, 2010 http://developer.android.com/guide/developing/tools/hierarchy-viewer.html

13 Views are tied to activities (screens) in Android Bruce Scharlau, University of Aberdeen, 2010 Source: unlocking android, p 60 One class per activity, and screen, which may be done as xml file

14 One layout per activity (class) Bruce Scharlau, University of Aberdeen, 2010 main.xml goes with AuctionStart list.xml goes with ListItems hit_server.xml goes with HitServer

15 Xml layout file details components Bruce Scharlau, University of Aberdeen, 2010 Hierarchy of views as noted earlier

16 Xml layout inflated in onCreate Bruce Scharlau, University of Aberdeen, 2010 Set value of inflated object INCOMPLETE CODE New view items and attached to xml values

17 Bruce Scharlau, University of Aberdeen, 2010 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 http://developer.android.com/guide/developing/tools/emulator.html

18 Bruce Scharlau, University of Aberdeen, 2010 Activity is one thing you can do From fundamentals page in sdk

19 Apps move through states during lifecycle Bruce Scharlau, University of Aberdeen, 2010 Source: unlocking android, p 68 onPause is last state to preserve state and cleanup before app possibly destroyed

20 Handler class provides access to running thread for main UI Bruce Scharlau, University of Aberdeen, 2010 Handler has Looper which contains MessageQueue that can be called and return objects to UI thread

21 Handler puts thread response into UI thread Bruce Scharlau, University of Aberdeen, 2010 Source: unlocking android, p 180

22 Method returns string from network Bruce Scharlau, University of Aberdeen, 2010 Log output for debugging, etc Simple method to call URL and return value

23 Might need helper calls to network Bruce Scharlau, University of Aberdeen, 2010 Put heavy lifting work in HTTPRequestHelper so accessible to other classes Handler waits for message and then returns

24 Parse xml response and populate Java bean instance Bruce Scharlau, University of Aberdeen, 2010

25 Add permissions to manifest for connection and network Bruce Scharlau, University of Aberdeen, 2010

26 Summary Need to provide permissions for network in manifest Create tree of xml views for UI Can re-use xml views for different displays Bruce Scharlau, University of Aberdeen, 2010


Download ppt "Bruce Scharlau, University of Aberdeen, 2010 Android UI, and Networking Mobile Computing Based on android-sdk_2.2 Unless otherwise stated, images are from."

Similar presentations


Ads by Google