ContentProvider of Android Four components (cont.)

Source: Internet
Author: User

1. What are the similarities between content provider and Web pages?

ContentProvider uses authority similar to the site's domain name ContentProvider can also provide a site-like indexing method
content://media/external/images/# 2, can you list several built-in content provider? Imagestore,constans,media, message,
3. What can you do with adb tools? Can get files and manipulate phone
4. What is an AVD? Android Vertual Device
5. How do you list the available AVDS? AndroidList Avds
6. What are some useful command line tool names in Android? Adb,ddms
7. Where is the database where the content provider corresponds? Under Data/data to create the project
8. What is the best way to browse a database? Cursor mode
9. What is the authority attribute of Content provider? is the domain name used for indexing, similar to Wen.
10, content provider authority can be abbreviated? No
11. What is the MIME type?  How is it associated with content provider? Is the type used to validate. 1) is the definition can make the system think your return security 2) is to set the necessary data in the androidmanifest.xml, so that the intent can use this type.
This.startactivity (new Intent (Action, URI));     The URI can be a record of the database, and then it needs to match ContentProvider's GetType type first. 12. How does the programmer find the URIs to communicate with a content provider?
13. How to access data through URIs? Mcontentresolver
14. How do I pass in a where statement for the content provider query statement? Mcontentresolver.query (Searchmetadata.content_uri,
Projection, selection, selectionarg, null)
15. How do I traverse a cursor? cursor cursor = mcontentresolver.query (Searchmetadata.content_uri,
Projection, selection, selectionarg, null);
if (cursor! = NULL) {
while (Cursor.movetonext ()) {
int persionid=
Cursor.getint (Cursor.getcolumnindex (searchmetadata.persiod_id));
String Path = cursor.getstring (cursor
. Getcolumnindex (Searchmetadata.bitmap_path));
if (!mpathhash.contains (path)) {
Mpathhash.add (path);//We not add same path twice
}
}
Cursor.close ();
}
16. What role does Content values play? Incoming database data, a record is a values
17. What role does the Contentresolver play? Media of the upper operating database
18. What is the protocol for storing a file in content provider?  The blob can be used to store large files, pictures, MP3 and so on directly.     getInputStream () and Getoutpurstream () to read and write binary information. 19, Urimatcher How to work, how to use Urimatcher?
    Static {        new  urimatcher (urimatcher.no_match);        Uri_matcher.adduri (authority, Searchmetadata.table_name,                search_collection_uri_indicater);         + "/#",                search_singal_uri_indicater);        Uri_matcher.adduri (authority, Applicationsmetadata.table_name,                applications_collection_uri_indicater);         + "/#",                applications_singal_uri_indicater);    }
intOP =Uri_matcher.match (URI); String Idapp= ""; Switch(OP) { CaseSearch_collection_uri_indicater:count=Db.delete (Searchmetadata.table_name, Selection, Selectionargs);  Break;  Casesearch_singal_uri_indicater:string ID= Uri.getpathsegments (). Get (1); Count=Db.delete (searchmetadata.table_name, searchmetadata._id+ "="                    +ID+ (! Textutils.isempty (selection)? "and (" + selection + ') '                            : ""), Selectionargs);  Break;  CaseApplications_singal_uri_indicater:idapp= Uri.getpathsegments (). Get (1);  Caseapplications_collection_uri_indicater:applicationsmetadata. Delete (DB, op, Idapp, Sele            Ction, Selectionargs);  Break; default:            Throw NewIllegalArgumentException ("Unknown Uri" +URI); }

ContentProvider of Android Four components (cont.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.