@@ -0,0 +1,2479 @@
+package com.hao.contactstest;%0A%0Aimport android.content.ContentProvider;%0Aimport android.content.ContentValues;%0Aimport android.content.UriMatcher;%0Aimport android.database.Cursor;%0Aimport android.net.Uri;%0A%0Apublic class MyProvider extends ContentProvider %7B%0A%0A    public static final int TABLE_DIR = 0;%0A    public static final int TABLE_ITEM = 1;%0A    public static final int TABLE2_DIR = 2;%0A    public static final int TABLE2_ITEM = 3;%0A    private static UriMatcher sUriMatcher;%0A%0A    static %7B%0A        sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);%0A        sUriMatcher.addURI(%22com.hao.contactstest.provider%22, %22table1%22, TABLE_DIR);%0A        sUriMatcher.addURI(%22com.hao.contactstest.provider%22, %22table1/#%22, TABLE_ITEM);%0A        sUriMatcher.addURI(%22com.hao.contactstest.provider%22, %22table2%22, TABLE2_DIR);%0A        sUriMatcher.addURI(%22com.hao.contactstest.provider%22, %22table2/#%22, TABLE2_ITEM);%0A    %7D%0A%0A    @Override%0A    public boolean onCreate() %7B%0A        return false;%0A    %7D%0A%0A    @Override%0A    public Cursor query(Uri uri, String%5B%5D projection, String selection, String%5B%5D selectionArgs,%0A            String sortOrder) %7B%0A        switch (sUriMatcher.match(uri)) %7B%0A        case TABLE_DIR:%0A            break;%0A%0A        case TABLE_ITEM:%0A            break;%0A%0A        case TABLE2_DIR:%0A            break;%0A%0A        case TABLE2_ITEM:%0A            break;%0A%0A        default:%0A            break;%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public String getType(Uri uri) %7B%0A        switch (sUriMatcher.match(uri)) %7B%0A        case TABLE_DIR:%0A            return %22vnd.android.cursor.dir/vnd.com.hao.contacts.provider.table1%22;%0A%0A        case TABLE_ITEM:%0A            return %22vnd.android.cursor.item/vnd.com.hao.contacts.provider.table1%22;%0A%0A        case TABLE2_DIR:%0A            return %22vnd.android.cursor.dir/vnd.com.hao.contacts.provider.table2%22;%0A%0A        case TABLE2_ITEM:%0A            return %22vnd.android.cursor.item/vnd.com.hao.contacts.provider.table2%22;%0A%0A        default:%0A            break;%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Uri insert(Uri uri, ContentValues values) %7B%0A        // TODO Auto-generated method stub%0A        return null;%0A    %7D%0A%0A    @Override%0A    public int delete(Uri uri, String selection, String%5B%5D selectionArgs) %7B%0A        // TODO Auto-generated method stub%0A        return 0;%0A    %7D%0A%0A    @Override%0A    public int update(Uri uri, ContentValues values, String selection, String%5B%5D selectionArgs) %7B%0A        // TODO Auto-generated method stub%0A        return 0;%0A    %7D%0A%0A%7D%0A

add a simple content provider