1 of 33

Code-A-Thon 2019

Intermediate Android Development

2 of 33

Network Information

The important things

  • WiFi: Guest_BYOD

3 of 33

Instructor Intro

  • Ila Hur
  • Android Developer at Capital One
  • Mobile Development for ~5 years
  • Education
    • Bachelors - Meredith College
    • Masters - George Mason University
  • Hobbies
    • Photography
    • Reading + Learning
    • Gaming
    • Traveling

4 of 33

Our TAs

5 of 33

Outline

  • What we’re building
  • What to expect
  • Topics
    • Networking + AlertDialog
    • GeoCoder
    • Recycler View
    • Intents + Parcelables

6 of 33

Let’s get started

7 of 33

What we’re building

8 of 33

What to expect

  • There are 4 main parts based on the Topics
  • Each part has an Exercise and Solution branch
    • Exercise branches contain a number TODOs to help guide you through the implementation process
    • Solution branches contain my solution as an example
      • Note: Your solution might be different and that is completely okay
  • By the end of this session, we will have a working Weather App that has a list of locations that navigate to the respective details page
  • Repo
  • One additional requirement - use Java 8

9 of 33

Networking & Alert Dialogs

10 of 33

Branches

  • Exercise
    • (Open) Step1_Networking_Exercise
    • (C1 Internal) StepOne_Networking_Exercise
  • Solution
    • (Open) Step1_Networking_Solution
    • (C1 Internal) StepOne_Networking_Solution

git checkout “<branch name>”

11 of 33

  • “Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster”
  • Benefits
    • Automatic scheduling of network requests.
    • Multiple concurrent network connections.
    • Transparent disk and memory response caching with standard HTTP cache coherence.
    • Support for request prioritization.
    • Cancellation request API. You can cancel a single request, or you can set blocks or scopes of requests to cancel.
    • Ease of customization, for example, for retry and backoff.
    • Strong ordering that makes it easy to correctly populate your UI with data fetched asynchronously from the network.
    • Debugging and tracing tools.

12 of 33

13 of 33

14 of 33

15 of 33

16 of 33

Geocoder

17 of 33

Branches

  • Exercise
    • (Open) Step2_Geocoder_Exercise
    • (C1 Internal) StepTwo_GeoCoder_Exercise
  • Solution
    • (Open) Step2_Geocoder_Solution
    • (C1 Internal) StepTwo_GeoCoder_Solution

git checkout “<branch name>”

18 of 33

  • A class for handling geocoding and reverse geocoding.
  • Geocoding
    • The process of transforming a street address or other description of a location into a (latitude, longitude) coordinate.
  • Reverse geocoding
    • The process of transforming a (latitude, longitude) coordinate into a (partial) address.

19 of 33

RecyclerViews

20 of 33

Branches

  • Exercise
    • (Open) Step3_RecyclerView_Exercise
    • (C1 Internal) StepThree_RecyclerView_Exercise
  • Solution
    • (Open) Step3_RecyclerView_Solution
    • (C1 Internal) StepThree_RecyclerView_Solution

git checkout “<branch name>”

21 of 33

  • If your app needs to display a scrolling list of elements based on large data sets (or data that frequently changes), you should use RecyclerView
  • More advanced and flexible version of ListView
  • Main Components
    • RecyclerView
      • LayoutManager - either LinearLayoutManager or GridLayoutManager
    • Adapter
    • ViewHolder

22 of 33

Library Dependency

23 of 33

In XML

24 of 33

Code Implementation

25 of 33

Code Implementation

26 of 33

Getting the Icons for Displaying

27 of 33

Intents & Parcelables

28 of 33

Branches

  • Exercise
    • (Open) Step4_IntentsParcelable_Exercise
    • (C1 Internal) StepFour_Intents_Parcelables_Exercise
  • Solution
    • (Open) Step4_IntentsParcelable_Solution
    • (C1 Internal) StepFour_Intents_Parcelables_Solution

git checkout “<branch name>”

29 of 33

  • An Intent is an abstract description of an operation to be performed
  • Used to launch an Activity, with BroadcastReceiver, and to communicate with a background Service
  • Structure
    • Action - A general action to be performed
    • Data - The data to operate on expressed as a Uri

30 of 33

  • Interface for classes that can be written to and restored from a Parcel object
  • What’s a Parcel?
    • It’s a container for a message, in the form of data and object references, that can be sent through an IBinder.
    • It can contain both flattened data that will be unflattened and references to live IBinder objects to result in the “other side” receiving a proxy IBinder connected with original IBinder in Parcel
    • What’s an IBinder?
      • Base interface for a remotable object, the core part of a lightweight remote procedure call mechanism for high performance with in-process and cross-process calls

31 of 33

Shortcut to Creating a Parcelable Object

Android Studio > Preferences > Plugins

32 of 33

Summary

33 of 33

Learn More

August 14th & 15th, 2019

androidsummit.org

August 9, 2019

iosdevcampdc.com