Permalink
Browse files

Done T0901-SetupContentProvider

  • Loading branch information...
GinaHsu committed Oct 16, 2017
1 parent d293857 commit e5a1177cfdd0fada3fe12d6d02cbb2907dbf293d
@@ -25,10 +25,13 @@
android:name="com.example.android.todolist.AddTaskActivity"
android:label="@string/add_task_activity_name" />
<!-- TODO (3) Register the TaskContentProvider -->
<!-- TODO (3) Register the TaskContentProvider,so your app knows the providers exist and knows how to refer to it by name and authority-->
<!-- TODO (4) Set name, authorities, and exported attributes -->
<!-- exported = false limits access to this ContentProvider to only this app -->
<provider android:name="com.example.android.todolist.data.TaskContentProvider"
android:authorities="com.example.android.todolist"
android:exported="false"/>
</application>
</manifest>
@@ -18,13 +18,15 @@
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.NonNull;
// TODO (1) Verify that TaskContentProvider extends from ContentProvider and implements required methods
public class TaskContentProvider extends ContentProvider {
private TaskDbHelper mTaskDbHelper;
/* onCreate() is where you should initialize anything you’ll need to setup
your underlying data source.
@@ -36,7 +38,9 @@ public boolean onCreate() {
// TODO (2) Complete onCreate() and initialize a TaskDbhelper on startup
// [Hint] Declare the DbHelper as a global variable
return false;
Context context = getContext();
mTaskDbHelper = new TaskDbHelper(context);
return true;
}

0 comments on commit e5a1177

Please sign in to comment.