Sans Pareil Technologies, Inc.

Key To Your Business

Exam 3 : Fragments, Files and Threads

Develop an application that will download a large image from the internet without blocking the main thread.  The image will need to scaled down from the original size to that of the ImageView used to display the image.

The UI should be composed of 5 widgets
  • An ImageView that will display the downloaded image (the image should occupy majority of the screen space)

  • A TextView that will display some contextual text messages related to the download, decoding and completed image (refer to pictures for requirements)

    • When image is being downloaded, should display a message with the size of the image that is being downloaded (see picture for exact message).

    • When download is complete and while image is being decoded, should display message "Decoding downloaded image".

    • When decoding is complete and image is displayed, display a message that indicates the original dimensions of the image as well as the final scaled down image size.  See picture for exact message format.  Note that the dimensions should be dynamically generated and not copied from the image.

    • When user clicks the stop button, should display the message "Download aborted" as shown in picture.  Note that there is no need to check if a download is in progress for this (you can if you wish to).

  • A Button that the user can use to start the image download.  There is no need to check is image is loaded or saved on disk.  Just download the image when user clicks the button. See picture for layout required.

  • A ProgressBar that will display the progress of the file download from the internet.

  • A Button that the user can use to stop the image download at any stage.  Clicking this button should also update the TextView with the message "Download aborted" as shown in the picture.

  • Part 2

    • The ImageView and TextView should be in one fragment (DisplayFragment for instance).

    • The start/stop Button widgets and the ProgressBar widget should be in another fragment (ControlsFragment for instance).

    • Follow standard recommendations when implementing the fragments

      • Fragments should have no knowledge of each other

      • The fragments should not interact directly with each other

    Note: You can reuse Lab8 for this work.