Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

by java. Question 3 Fragments, networking and concurrency [40 marks] In this question, you develop an Android app that displays the local time and the

by java.image text in transcribedimage text in transcribed

Question 3 Fragments, networking and concurrency [40 marks] In this question, you develop an Android app that displays the local time and the time from a daytime server. A skeleton project, called Daytime, is provided to you. Complete the project by working through the following tasks. a. In the MainActivity class, create and show the MainFragment when the app starts. b. In the MainFragment class, modify the onCreateView method to set up the Get Time button to call the getTime method. Modify the getTime method to connect the server host at port 13, read the text data from the server (i.e., server time), and display the time in the UI. In case of network failure or other errors, display the error message in the UI. c. Create a AboutFragment class and its associated fragment_about.xml layout, for displaying the information about the daytime protocol. Use the daytime_rfc string resource for the text in the layout. d. In the MainFragment class, set up the About Daytime Protocol button to create and show the AboutFragment(showing a text messenge)text copyright/about author). The following screenshots show the main screen and about-daytime screen of the app. Submit one whole Android project that contains all your work for this question.

6:02 0 6:04 0 Daytime Daytime Local time 6:02 PM Local time 6:04 PM Daytime server stdtime.gov.hk 08 MAR 2020 10:02:46 UTC GET TIME GET TIME Daytime server error.example.com Unable to resolve host 'error.example.com": No address associated with hostname ABOUT DAYTIME PROTOCOL ABOUT DAYTIME PROTOCOL Daytime Daytime Protocol RFC, https://cols.ietf.org/rfc967 This life specifies a standard for the ARPA Irtemet community Hosts on the ARPA Internet that choose to implement a Daytime Protocol are expected to adopt and implement this standard. Auseu debugging and measurement tools a daytime service. A daycine service simply sends a the current date and time as a character siring without regard to the inpul. TCP Based Daytime Service One daytime service is defined as a connection based application on TCP server listens for TCP connections on TCP port 13 Once a connection is established the current date and time is sent out the connections Ancil character string (and any data reservedis thrown away). The service closes the connection after sending the vuole. VOP Based Daytime Service Another daytime service service is defined as a datagram based application on UDP server listens for UDP stagrams on UDP port 13 When a dartegram is received an answering datagrom is sent containing the current date and time osa Asci character string (the data in the received datagrart is ingred) Daytime Syntax There is no specific syntax for the daytime. It is recommended that it be limited to the ASCII printing characters space carriage return, and ine teed. The daytime should be just one line 6:02 0 6:04 0 Daytime Daytime Local time 6:02 PM Local time 6:04 PM Daytime server stdtime.gov.hk 08 MAR 2020 10:02:46 UTC GET TIME GET TIME Daytime server error.example.com Unable to resolve host 'error.example.com": No address associated with hostname ABOUT DAYTIME PROTOCOL ABOUT DAYTIME PROTOCOL Daytime Daytime Protocol RFC, https://cols.ietf.org/rfc967 This life specifies a standard for the ARPA Irtemet community Hosts on the ARPA Internet that choose to implement a Daytime Protocol are expected to adopt and implement this standard. Auseu debugging and measurement tools a daytime service. A daycine service simply sends a the current date and time as a character siring without regard to the inpul. TCP Based Daytime Service One daytime service is defined as a connection based application on TCP server listens for TCP connections on TCP port 13 Once a connection is established the current date and time is sent out the connections Ancil character string (and any data reservedis thrown away). The service closes the connection after sending the vuole. VOP Based Daytime Service Another daytime service service is defined as a datagram based application on UDP server listens for UDP stagrams on UDP port 13 When a dartegram is received an answering datagrom is sent containing the current date and time osa Asci character string (the data in the received datagrart is ingred) Daytime Syntax There is no specific syntax for the daytime. It is recommended that it be limited to the ASCII printing characters space carriage return, and ine teed. The daytime should be just one line

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions