publicclassMyContentProviderextendsContentProvider{private SQLiteDatabase db;publicMyContentProvider(){}@Overridepublicintdelete(Uri uri, String selection, String[] selectionArgs){// Implement this to handle requests to delete one or more rows.int person = db.delete("person", selection, selectionArgs);return person;}@Overridepublic String getType(Uri uri){// TODO: Implement this to handle requests for the MIME type of the data// at the given URI.thrownewUnsupportedOperationException("Not yet implemented");}@Overridepublic Uri insert(Uri uri, ContentValues values){long person = db.insert("person", null, values);return uri;}@OverridepublicbooleanonCreate(){// TODO: Implement this to initialize your content provider on startup.
MySqlHelper mySqlHelper =newMySqlHelper(getContext(),"person.db", null,2);
db = mySqlHelper.getWritableDatabase();if(db!=null){returntrue;}returnfalse;}@Overridepublic Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder){
Cursor person = db.query("person", projection, selection, selectionArgs, null, null, sortOrder);return person;}@Overridepublicintupdate(Uri uri, ContentValues values, String selection,
String[] selectionArgs){int person = db.update("person", values, selection, selectionArgs);return person;}}