34,333
edits
Changes
m
Text replacement - "<table border="0" cellspacing="0">" to "<table border="0" cellspacing="0" width="100%">"
<htmlet>androidstudio_a6androidstudio</htmlet>
The next phase is to implement the necessary code within the activity to bind to the service and call the getCurrentTime() method.
<htmlet>androidstudio_a6androidstudio</htmlet>
== Binding the Client to the Service ==
== Completing the Example ==
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
All that remains is to implement a mechanism for calling the getCurrentTime() method and displaying the result to the user. As is now customary, Android Studio will have created a template activity_local_bound.xml file for the activity containing only a TextView. Load this file into the Designer tool using Design mode, double-click on the TextView component and change the ID to @+id/myTextView. Move the TextView to the center of the display canvas, add a Button view beneath the TextView and change the text on the button to read “Show Time”, extracting the text to a string resource named button_string. On completion of these changes, the layout should resemble that illustrated in Figure 38-1:
<htmlet>androidstudio_a6androidstudio</htmlet>
<htmlet>ezoicbottom</htmlet>
<hr>
<table border="0" cellspacing="0" width="100%">