It's written to this way

Month: March 2018

Lesson 11: Sharing Data with Content Providers (11.1B: Add a content provider to your database)

Task 1. Download and run the base code

Task 2. Add a Contract class to WordListSQLInteractive

2.1 Add a Contract class

2.2 Move database constants into Contract

2.3 Define URI Constants

2.4 Declare the MIME types

Task 3. Create a Content Provider

3.1 Create a WordListContentProvider class

3.2 Implement WordListContentProvider.query()

3.3 Fix WordListOpenHelper.query() to return a Cursor and handle returning all items

 

3.4 Fix WordListOpenHelper.count() to return a Cursor

3.5 Fix WordListAdapter.onBindViewHolder() to use a content resolver

3.6 Change WordListAdapter.getItemCount() to use a content resolver

3.7 Add the content provider to the Android Manifest

3.8 What’s next?

Task 4. Implement Content Provider methods

4.1 getType()

4.2 Call the content provider to insert and update words in MainActivity

4.3 Implement insert() in the content provider

4.4 Fix insert() in WordListOpenHelper

4.5 Implement update() in the content provider

4.6 Implement delete() in the content provider

4.7 Run your app

Lesson 11: Sharing Data with Content Providers (11.1A: Implement a Minimalist Content Provider)

Task 1. Create the MinimalistContentProvider project

1.1. Create a project within the given constraints

1.2. Complete the basic setup

Task 2. Create a Contract class, a URI, and mock data

2.1. Create the Contract class

2.2. Create the URI

2.3. Add the MIME Type

2.4. Create the mock data

Task 3. Implement the MiniContentProvider class

3.1. Create the MiniContentProvider class

3.2. Publish the content provider by adding it to the Android manifest

3.3. Set up URI matching

3.4. Implement the getType() method

3.5 Implement the query() method

3.6. Implement the populateCursor() method

Task 4. Use a ContentResolver to get data

4.1. Get the content resolver

4.2. Define the query arguments

4.3. Decide on selection criteria

4.4. Process the Cursor

 

© 2024 Dwimagita's blog

Theme by Anders NorenUp ↑