Links to tutorial articles for Android Studio
Http://www.open-open.com/lib/view/open1468121363300.html
Content providers can expose their own databases to other users ' applications for access.
* Create a class Provider extend inherit ContentProvider
* Configure content providers in the manifest file. Xml. Configure the full path and host name.
Android:name= "Cn.itcast.contentprovider.PersonDBProvider"
* A URI that defines some data operations in the provider class
Add some specified special paths using the Urimarcher method
Matcher.adduri ("Cn.itcast.contentprovider.personprovider", "Insert", 1); Matcher.adduri (" Cn.itcast.contentprovider.personprovider "," delete ", 2); Matcher.adduri (" Cn.itcast.contentprovider.personprovider "," Update ", 3); Matcher.adduri (" Cn.itcast.contentprovider.personprovider "," Query ", 4);
* To achieve provider additions and deletions of the search method.
***
Querying data by Using content providers
* Get the parser for the content provider
Contentresolver Resolver=getcontentresolver ();
* Use resolver to delete the operation of the check.
NULL NULL NULL null);
while (Cursor.movetonext ()) {
int id = cursor.getint (cursor.getcolumnindex ("id"));
String name = cursor.getstring (Cursor.getcolumnindex ("name"));
String number = cursor.getstring (Cursor.getcolumnindex ("number"));
Person p = new person (ID, name, number);
Persons.add (P);
}
Cursor.close ();
Initial use of Android Studio, ContentProvider created