URIMatcher

github: T0901-SetupContentProvider , T0902-AddURLsToContract , T0903- UriMatcher , uriMatcher for TASKS_ID 

* The screenshots in the blog are from the Udacity Nanodegree Program: Become an Android Developer *

URI –

  1. Identify your provider
  2. Identify different types of data that the provider can work with

URI Structure –

Screen Shot 2017-10-16 at 4.43.02 PM

Screen Shot 2017-10-05 at 4.35.00 PMScreen Shot 2017-10-16 at 5.13.12 PM

screen-shot-2017-10-16-at-5-01-24-pm1.png

Screen Shot 2017-10-18 at 5.44.59 PM

When we want to check a URI tasks, we may have the below statement. But that can be tricky if a string has an integer ID at the end. 

Screen Shot 2017-10-18 at 5.44.39 PM

URIMatcher –

Screen Shot 2017-10-18 at 5.45.39 PM

As long as the URI has an integer (“/#”) after the initial tasks path, this matcher will recognize it and associate it with the int constant TASK_WITH_ID.

Screen Shot 2017-10-18 at 6.24.46 PM

Screen Shot 2017-10-18 at 5.46.14 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s