Return to Video

Use CursorLoader with WeatherProvider - Developing Android Apps

  • 0:00 - 0:04
    We've spent a long time
    building a content provider.
  • 0:04 - 0:06
    But, we are only using
    it just enough for
  • 0:06 - 0:09
    us to test that we got
    the content provider working.
  • 0:09 - 0:14
    When we query the database,
    here's how these classes are used.
  • 0:14 - 0:18
    Our UI, first, builds a URI,
    using the weathercontract.
  • 0:18 - 0:22
    The UI then uses this UI to call
    a method in the Content Resolver.
  • 0:22 - 0:26
    Which ultimately forwards
    the request to our WeatherProvider.
  • 0:26 - 0:28
    Our WeatherProvider
    uses Weather DB Helper
  • 0:28 - 0:31
    to get an instance of SQLite Database.
  • 0:31 - 0:34
    Creating, or updating the tables
    of our database is necessary.
  • 0:34 - 0:39
    We then pass the SQL query
    to the SQLiteDatabase class,
  • 0:39 - 0:42
    which sends our query off
    to our SQLite database.
  • 0:42 - 0:45
    Cursor Loader takes the URI, and
  • 0:45 - 0:49
    calls the Content Resolver on our
    behalf, inside of an AsyncTask.
  • 0:49 - 0:52
    Ultimately, the cursor gets
    returned to the Android UI,
  • 0:52 - 0:57
    and it will be used by a cursor adapter,
    to populate the list view,
  • 0:57 - 0:59
    in Sunshine from our database cursor.
  • 0:59 - 1:03
    Similar to the way our array adapter
    populated the list view from an array.
  • 1:03 - 1:06
    For our next task, we are going
    to replace the array adapter,
  • 1:06 - 1:10
    we have currently in forecast fragment,
    with a cursor adapter.
  • 1:10 - 1:13
    We'll eventually connect it to our
    database using a cursor loader.
タイトル:
Use CursorLoader with WeatherProvider - Developing Android Apps
概説:

more » « less
Video Language:
English
Team:
Udacity
プロジェクト:
UD853 - Developing Android Apps
Duration:
01:14

English subtitles

改訂 Compare revisions