Home | History | Annotate | Download | only in providers
      1 page.title=
      2 @jd:body
      3 <div id="qv-wrapper">
      4 <div id="qv">
      5 
      6 
      7 <h2></h2>
      8 <ol>
      9     <li>
     10         <a href="#DataStorage"></a>
     11     </li>
     12     <li>
     13         <a href="#ContentURI"> URI</a>
     14     </li>
     15     <li>
     16         <a href="#ContentProvider"> ContentProvider </a>
     17         <ol>
     18             <li>
     19                 <a href="#RequiredAccess"></a>
     20             </li>
     21             <li>
     22                 <a href="#Query"> query() </a>
     23             </li>
     24             <li>
     25                 <a href="#Insert"> insert() </a>
     26             </li>
     27             <li>
     28                 <a href="#Delete"> delete() </a>
     29             </li>
     30             <li>
     31                 <a href="#Update"> update() </a>
     32             </li>
     33             <li>
     34                 <a href="#OnCreate"> onCreate() </a>
     35             </li>
     36         </ol>
     37     </li>
     38     <li>
     39         <a href="#MIMETypes"> MIME </a>
     40         <ol>
     41             <li>
     42                 <a href="#TableMIMETypes"> MIME </a>
     43             </li>
     44             <li>
     45                 <a href="#FileMIMETypes"> MIME </a>
     46             </li>
     47         </ol>
     48     </li>
     49     <li>
     50         <a href="#ContractClass"></a>
     51     </li>
     52     <li>
     53         <a href="#Permissions"></a>
     54     </li>
     55     <li>
     56         <a href="#ProviderElement">&lt;provider&gt; </a>
     57     </li>
     58     <li>
     59         <a href="#Intents"></a>
     60     </li>
     61 </ol>
     62 <h2></h2>
     63     <ol>
     64         <li>
     65             {@link android.content.ContentProvider}
     66         </li>
     67         <li>
     68             {@link android.database.Cursor}
     69         </li>
     70         <li>
     71             {@link android.net.Uri}
     72         </li>
     73     </ol>
     74 <h2></h2>
     75     <ol>
     76         <li>
     77             <a href="{@docRoot}resources/samples/NotePad/index.html">                Note Pad 
     78             </a>
     79 
     80         </li>
     81     </ol>
     82 <h2></h2>
     83     <ol>
     84         <li>
     85             <a href="{@docRoot}guide/topics/providers/content-provider-basics.html">        </a>
     86 
     87         </li>
     88         <li>
     89             <a href="{@docRoot}guide/topics/providers/calendar-provider.html">        </a>
     90 
     91         </li>
     92     </ol>
     93 </div>
     94 </div>
     95 
     96 
     97 <p>
     98      Android 
     99 
    100 
    101 {@link android.content.ContentProvider} ()
    102  Activity
    103 
    104 
    105 </p>
    106 <p>
    107      API 
    108 
    109 </p>
    110 
    111 
    112 <!-- Before You Start Building -->
    113 <h2 id="BeforeYouStart"></h2>
    114 <p>
    115     
    116 </p>
    117 <ol>
    118     <li>
    119         <strong></strong>
    120 
    121         <ul>
    122             <li></li>
    123             <li></li>
    124             <li></li>
    125         </ul>
    126     <p>
    127         <em></em> SQLite 
    128 
    129     </p>
    130     </li>
    131     <li>
    132         <a href="{@docRoot}guide/topics/providers/content-provider-basics.html"></a> ()
    133 
    134 
    135     </li>
    136 </ol>
    137 <p>
    138     
    139 </p>
    140 <ol>
    141     <li>
    142         
    143         <dl>
    144             <dt>
    145                 
    146             </dt>
    147             <dd>
    148                 
    149 
    150 
    151 
    152             </dd>
    153             <dt>
    154                 
    155             </dt>
    156             <dd>
    157                 
    158                 
    159 
    160  SQLite 
    161 
    162  Android <a href="#DataStorage"></a>
    163 
    164 
    165             </dd>
    166         </dl>
    167     </li>
    168     <li>
    169          {@link android.content.ContentProvider} 
    170  Android 
    171 <a href="#ContentProvider"> ContentProvider </a>
    172 
    173     </li>
    174     <li>
    175          URI 
    176 
    177 
    178 
    179  URI<a href="#ContentURI"> URI</a>
    180 
    181 
    182         <a href="#Intents"></a>
    183 
    184     </li>
    185     <li>
    186          {@link android.content.AbstractThreadedSyncAdapter} 
    187 
    188 
    189     </li>
    190 </ol>
    191 
    192 
    193 <!-- Designing Data Storage -->
    194 <h2 id="DataStorage"></h2>
    195 <p>
    196     
    197 
    198 
    199 </p>
    200 <p>
    201      Android 
    202 </p>
    203 <ul>
    204     <li>
    205         Android  SQLite  API Android 
    206 
    207 {@link android.database.sqlite.SQLiteOpenHelper}  {@link android.database.sqlite.SQLiteDatabase} 
    208 
    209 
    210         <p>
    211              ()
    212 
    213 
    214         </p>
    215     </li>
    216     <li>
    217          Android  API
    218         <a href="{@docRoot}guide/topics/data/data-storage.html"></a>
    219  () 
    220 
    221 
    222     </li>
    223     <li>
    224          {@link java.net} 
    225 {@link android.net}  ()
    226 
    227         <a href="{@docRoot}resources/samples/SampleSyncAdapter/index.html"></a>
    228 
    229     </li>
    230 </ul>
    231 <h3 id="DataDesign">
    232     
    233 </h3>
    234 <p>
    235     
    236 </p>
    237 <ul>
    238     <li>
    239         
    240  ()
    241  {@link android.provider.BaseColumns#_ID BaseColumns._ID} 
    242 {@link android.widget.ListView}  
    243 <code>_ID</code>
    244 
    245 
    246     </li>
    247     <li>
    248         
    249 
    250 
    251 {@link android.content.ContentResolver} 
    252     </li>
    253     <li>
    254          (BLOB) 
    255  BLOB <a href="http://code.google.com/p/protobuf"></a> <a href="http://www.json.org">JSON </a>
    256 
    257 
    258         <p>
    259              BLOB <em></em>MIME  BLOB 
    260 
    261 MIME  BLOB 
    262 
    263 
    264 {@link android.provider.ContactsContract.Data} 
    265 
    266         </p>
    267     </li>
    268 </ul>
    269 <!-- Designing Content URIs -->
    270 <h2 id="ContentURI"> URI</h2>
    271 <p>
    272     <strong> URI</strong>  URI (<strong></strong>) (<strong></strong>)
    273 
    274  ID 
    275 
    276 {@link android.content.ContentProvider}  URI () URI 
    277 
    278 </p>
    279 <p>
    280      URI <a href="{@docRoot}guide/topics/providers/content-provider-basics.html"></a>
    281 
    282 
    283 </p>
    284 <h3></h3>
    285 <p>
    286      Android 
    287 
    288  Android 
    289 
    290  Android 
    291  <code>com.example.&lt;appname&gt;</code> 
    292 <code>com.example.&lt;appname&gt;.provider</code>
    293 </p>
    294 <h3></h3>
    295 <p>
    296      URI
    297 table1<em></em>table2<em></em> URI 
    298 <code>com.example.&lt;appname&gt;.provider/table1</code>  
    299 <code>com.example.&lt;appname&gt;.provider/table2</code>
    300 
    301 
    302 
    303 </p>
    304 <h3> URI ID</h3>
    305 <p>
    306      URI  ID  URI ID  <code>_ID</code> 
    307 
    308 
    309 
    310 </p>
    311 <p>
    312      {@link android.widget.CursorAdapter}  {@link android.widget.ListView}  {@link android.database.Cursor}
    313 
    314 
    315      {@link android.widget.CursorAdapter} 
    316 {@link android.database.Cursor}  <code>_ID</code>
    317 </p>
    318 <p>
    319      UI 
    320 
    321  {@link android.widget.ListView}  {@link android.database.Cursor}  <code>_ID</code>  URI 
    322 
    323 
    324 </p>
    325 <h3> URI </h3>
    326 <p>
    327      URI  API  {@link android.content.UriMatcher} URI
    328 
    329  <code>switch</code>  URI 
    330 
    331 </p>
    332 <p>
    333      URI  URI
    334 </p>
    335     <ul>
    336         <li>
    337             <strong><code>*</code></strong>
    338         </li>
    339         <li>
    340             <strong><code>#</code></strong>
    341         </li>
    342     </ul>
    343 <p>
    344      URI  <code>com.example.app.provider</code>  URI
    345 
    346 
    347 </p>
    348 <ul>
    349     <li>
    350         <code>content://com.example.app.provider/table1</code> <code>table1</code> 
    351     </li>
    352     <li>
    353         <code>content://com.example.app.provider/table2/dataset1</code> 
    354 <code>dataset1</code> 
    355     </li>
    356     <li>
    357         <code>content://com.example.app.provider/table2/dataset2</code> 
    358 <code>dataset2</code> 
    359     </li>
    360     <li>
    361         <code>content://com.example.app.provider/table3</code> <code>table3</code> 
    362     </li>
    363 </ul>
    364 <p>
    365      ID  URI <code>content://com.example.app.provider/table3/1</code>  <code>table3</code>  ID 
    366  <code>1</code> 
    367 
    368 </p>
    369 <p>
    370      URI 
    371 </p>
    372 <dl>
    373     <dt>
    374         <code>content://com.example.app.provider/*</code>
    375     </dt>
    376     <dd>
    377          URI 
    378     </dd>
    379     <dt>
    380         <code>content://com.example.app.provider/table2/*</code>
    381     </dt>
    382     <dd>
    383          <code>dataset1</code>  <code>dataset2</code>  URI  <code>table1</code>  
    384 <code>table3</code>  URI 
    385 
    386     </dd>
    387     <dt>
    388         <code>content://com.example.app.provider/table3/#</code> <code>table3</code>  URI
    389  <code>content://com.example.app.provider/table3/6</code> 
    390  <code>6</code> 
    391 
    392     </dt>
    393 </dl>
    394 <p>
    395      {@link android.content.UriMatcher} 
    396      URI  URI URI  
    397 <code>content://&lt;authority&gt;/&lt;path&gt;</code> 
    398 <code>content://&lt;authority&gt;/&lt;path&gt;/&lt;id&gt;</code>
    399 
    400 </p>
    401 <p>
    402     {@link android.content.UriMatcher#addURI(String, String, int) addURI()} 
    403  {@link android.content.UriMatcher#match(Uri)
    404     match()}  URI <code>switch</code> 
    405 
    406 </p>
    407 <pre class="prettyprint">
    408 public class ExampleProvider extends ContentProvider {
    409 ...
    410     // Creates a UriMatcher object.
    411     private static final UriMatcher sUriMatcher;
    412 ...
    413     /*
    414      * The calls to addURI() go here, for all of the content URI patterns that the provider
    415      * should recognize. For this snippet, only the calls for table 3 are shown.
    416      */
    417 ...
    418     /*
    419      * Sets the integer value for multiple rows in table 3 to 1. Notice that no wildcard is used
    420      * in the path
    421      */
    422     sUriMatcher.addURI("com.example.app.provider", "table3", 1);
    423 
    424     /*
    425      * Sets the code for a single row to 2. In this case, the "#" wildcard is
    426      * used. "content://com.example.app.provider/table3/3" matches, but
    427      * "content://com.example.app.provider/table3 doesn't.
    428      */
    429     sUriMatcher.addURI("com.example.app.provider", "table3/#", 2);
    430 ...
    431     // Implements ContentProvider.query()
    432     public Cursor query(
    433         Uri uri,
    434         String[] projection,
    435         String selection,
    436         String[] selectionArgs,
    437         String sortOrder) {
    438 ...
    439         /*
    440          * Choose the table to query and a sort order based on the code returned for the incoming
    441          * URI. Here, too, only the statements for table 3 are shown.
    442          */
    443         switch (sUriMatcher.match(uri)) {
    444 
    445 
    446             // If the incoming URI was for all of table3
    447             case 1:
    448 
    449                 if (TextUtils.isEmpty(sortOrder)) sortOrder = "_ID ASC";
    450                 break;
    451 
    452             // If the incoming URI was for a single row
    453             case 2:
    454 
    455                 /*
    456                  * Because this URI was for a single row, the _ID value part is
    457                  * present. Get the last path segment from the URI; this is the _ID value.
    458                  * Then, append the value to the WHERE clause for the query
    459                  */
    460                 selection = selection + "_ID = " uri.getLastPathSegment();
    461                 break;
    462 
    463             default:
    464             ...
    465                 // If the URI is not recognized, you should do some error handling here.
    466         }
    467         // call the code to actually do the query
    468     }
    469 </pre>
    470 <p>
    471      {@link android.content.ContentUris}  URI  <code>id</code> 
    472 {@link android.net.Uri}  
    473 {@link android.net.Uri.Builder}  
    474 {@link android.net.Uri} 
    475 </p>
    476 
    477 <!-- Implementing the ContentProvider class -->
    478 <h2 id="ContentProvider"> ContentProvider </h2>
    479 <p>
    480     {@link android.content.ContentProvider} 
    481  {@link android.content.ContentResolver} {@link android.content.ContentProvider} 
    482 
    483 
    484 </p>
    485 <h3 id="RequiredAccess"></h3>
    486 <p>
    487      {@link android.content.ContentProvider}  6 
    488  
    489 ({@link android.content.ContentProvider#onCreate() onCreate()} )
    490 
    491 </p>
    492 <dl>
    493     <dt>
    494         {@link android.content.ContentProvider#query(Uri, String[], String, String[], String)
    495         query()}
    496     </dt>
    497     <dd>
    498         
    499 
    500          {@link android.database.Cursor} 
    501     </dd>
    502     <dt>
    503         {@link android.content.ContentProvider#insert(Uri, ContentValues) insert()}
    504     </dt>
    505     <dd>
    506         
    507  URI
    508 
    509     </dd>
    510     <dt>
    511         {@link android.content.ContentProvider#update(Uri, ContentValues, String, String[])
    512         update()}
    513     </dt>
    514     <dd>
    515         
    516 
    517     </dd>
    518     <dt>
    519         {@link android.content.ContentProvider#delete(Uri, String, String[]) delete()}
    520     </dt>
    521     <dd>
    522         
    523 
    524     </dd>
    525     <dt>
    526         {@link android.content.ContentProvider#getType(Uri) getType()}
    527     </dt>
    528     <dd>
    529          URI  MIME <a href="#MIMETypes"> MIME </a>
    530 
    531     </dd>
    532     <dt>
    533         {@link android.content.ContentProvider#onCreate() onCreate()}
    534     </dt>
    535     <dd>
    536         Android 
    537 
    538  {@link android.content.ContentResolver} Android 
    539     </dd>
    540 </dl>
    541 <p>
    542      
    543 {@link android.content.ContentResolver} 
    544 </p>
    545 <p>
    546     
    547 </p>
    548 <ul>
    549     <li>
    550          {@link android.content.ContentProvider#onCreate() onCreate()} 
    551 <a href="{@docRoot}guide/components/processes-and-threads.html"></a>
    552 
    553 
    554 
    555     </li>
    556     <li>
    557          {@link android.content.ContentProvider#onCreate()
    558         onCreate()} 
    559         <a href="#OnCreate"> onCreate() </a>
    560 
    561     </li>
    562     <li>
    563         
    564 
    565 
    566 {@link android.content.ContentProvider#insert(Uri, ContentValues) insert()}  0
    567 
    568     </li>
    569 </ul>
    570 <h3 id="Query"> query() </h3>
    571 <p>
    572     {@link android.content.ContentProvider#query(Uri, String[], String, String[], String)
    573     ContentProvider.query()}  {@link android.database.Cursor}  {@link java.lang.Exception}
    574 
    575  SQLite 
    576 {@link android.database.sqlite.SQLiteDatabase}  <code>query()</code>  {@link android.database.Cursor}
    577 
    578      {@link android.database.Cursor#getCount()}  0 
    579  {@link android.database.Cursor} 
    580      <code>null</code>
    581 </p>
    582 <p>
    583      SQLite 
    584  {@link android.database.Cursor} {@link android.database.MatrixCursor} 
    585  {@link java.lang.Object}  {@link android.database.MatrixCursor#addRow(Object[]) addRow()} 
    586 
    587 </p>
    588 <p>
    589      Android  {@link java.lang.Exception} 
    590 Android 
    591 
    592 </p>
    593 <ul>
    594     <li>
    595         {@link java.lang.IllegalArgumentException} ( URI )
    596 
    597     </li>
    598     <li>
    599         {@link java.lang.NullPointerException}
    600     </li>
    601 </ul>
    602 <h3 id="Insert"> insert() </h3>
    603 <p>
    604     {@link android.content.ContentProvider#insert(Uri, ContentValues) insert()}  {@link android.content.ContentValues} 
    605 
    606  {@link android.content.ContentValues} 
    607 
    608 
    609 </p>
    610 <p>
    611      URI {@link android.content.ContentUris#withAppendedId(Uri, long) withAppendedId()} <code>_ID</code> ()  URI
    612 
    613 
    614 </p>
    615 <h3 id="Delete"> delete() </h3>
    616 <p>
    617     {@link android.content.ContentProvider#delete(Uri, String, String[]) delete()} 
    618 
    619 
    620 
    621 
    622 </p>
    623 <h3 id="Update"> update() </h3>
    624 <p>
    625     {@link android.content.ContentProvider#update(Uri, ContentValues, String, String[])
    626     update()}  {@link android.content.ContentProvider#insert(Uri, ContentValues) insert()}  {@link android.content.ContentValues} 
    627  {@link android.content.ContentProvider#delete(Uri, String, String[]) delete()}  {@link android.content.ContentProvider#query(Uri, String[], String, String[], String)
    628     ContentProvider.query()}  <code>selection</code>  <code>selectionArgs</code> 
    629 
    630 
    631 
    632 </p>
    633 <h3 id="OnCreate"> onCreate() </h3>
    634 <p>
    635     Android  {@link android.content.ContentProvider#onCreate()
    636     onCreate()}
    637 
    638  {@link android.content.ContentProvider#onCreate() onCreate()} 
    639 
    640 
    641 
    642 </p>
    643 <p>
    644      SQLite  
    645 {@link android.content.ContentProvider#onCreate() ContentProvider.onCreate()}  {@link android.database.sqlite.SQLiteOpenHelper}  SQL 
    646 
    647  {@link android.database.sqlite.SQLiteOpenHelper#getWritableDatabase
    648 getWritableDatabase()}  {@link android.database.sqlite.SQLiteOpenHelper#onCreate(SQLiteDatabase)
    649 SQLiteOpenHelper.onCreate()} 
    650 
    651 
    652 </p>
    653 <p>
    654      
    655 {@link android.content.ContentProvider#onCreate() ContentProvider.onCreate()}  {@link android.database.sqlite.SQLiteOpenHelper#onCreate(SQLiteDatabase)
    656     SQLiteOpenHelper.onCreate()} 
    657  
    658 {@link android.content.ContentProvider#onCreate() ContentProvider.onCreate()}
    659 </p>
    660 <pre class="prettyprint">
    661 public class ExampleProvider extends ContentProvider
    662 
    663     /*
    664      * Defines a handle to the database helper object. The MainDatabaseHelper class is defined
    665      * in a following snippet.
    666      */
    667     private MainDatabaseHelper mOpenHelper;
    668 
    669     // Defines the database name
    670     private static final String DBNAME = "mydb";
    671 
    672     // Holds the database object
    673     private SQLiteDatabase db;
    674 
    675     public boolean onCreate() {
    676 
    677         /*
    678          * Creates a new helper object. This method always returns quickly.
    679          * Notice that the database itself isn't created or opened
    680          * until SQLiteOpenHelper.getWritableDatabase is called
    681          */
    682         mOpenHelper = new MainDatabaseHelper(
    683             getContext(),        // the application context
    684             DBNAME,              // the name of the database)
    685             null,                // uses the default SQLite cursor
    686             1                    // the version number
    687         );
    688 
    689         return true;
    690     }
    691 
    692     ...
    693 
    694     // Implements the provider's insert method
    695     public Cursor insert(Uri uri, ContentValues values) {
    696         // Insert code here to determine which table to open, handle error-checking, and so forth
    697 
    698         ...
    699 
    700         /*
    701          * Gets a writeable database. This will trigger its creation if it doesn't already exist.
    702          *
    703          */
    704         db = mOpenHelper.getWritableDatabase();
    705     }
    706 }
    707 </pre>
    708 <p>
    709      {@link android.database.sqlite.SQLiteOpenHelper#onCreate(SQLiteDatabase)
    710 SQLiteOpenHelper.onCreate()}
    711 
    712 </p>
    713 <pre class="prettyprint">
    714 ...
    715 // A string that defines the SQL statement for creating a table
    716 private static final String SQL_CREATE_MAIN = "CREATE TABLE " +
    717     "main " +                       // Table's name
    718     "(" +                           // The columns in the table
    719     " _ID INTEGER PRIMARY KEY, " +
    720     " WORD TEXT"
    721     " FREQUENCY INTEGER " +
    722     " LOCALE TEXT )";
    723 ...
    724 /**
    725  * Helper class that actually creates and manages the provider's underlying data repository.
    726  */
    727 protected static final class MainDatabaseHelper extends SQLiteOpenHelper {
    728 
    729     /*
    730      * Instantiates an open helper for the provider's SQLite data repository
    731      * Do not do database creation and upgrade here.
    732      */
    733     MainDatabaseHelper(Context context) {
    734         super(context, DBNAME, null, 1);
    735     }
    736 
    737     /*
    738      * Creates the data repository. This is called when the provider attempts to open the
    739      * repository and SQLite reports that it doesn't exist.
    740      */
    741     public void onCreate(SQLiteDatabase db) {
    742 
    743         // Creates the main table
    744         db.execSQL(SQL_CREATE_MAIN);
    745     }
    746 }
    747 </pre>
    748 
    749 
    750 <!-- Implementing ContentProvider MIME Types -->
    751 <h2 id="MIMETypes"> ContentProvider MIME </h2>
    752 <p>
    753     {@link android.content.ContentProvider}  MIME 
    754 </p>
    755 <dl>
    756     <dt>
    757         {@link android.content.ContentProvider#getType(Uri) getType()}
    758     </dt>
    759     <dd>
    760         
    761     </dd>
    762     <dt>
    763         {@link android.content.ContentProvider#getStreamTypes(Uri, String) getStreamTypes()}
    764     </dt>
    765     <dd>
    766         
    767     </dd>
    768 </dl>
    769 <h3 id="TableMIMETypes"> MIME </h3>
    770 <p>
    771     {@link android.content.ContentProvider#getType(Uri) getType()}  MIME 
    772  {@link java.lang.String} URI 
    773 {@link android.net.Uri}  ( URI) URI 
    774 
    775 
    776 </p>
    777 <p>
    778     HTMLJPEG 
    779 {@link android.content.ContentProvider#getType(Uri) getType()}  MIME 
    780 
    781  <a href="http://www.iana.org/assignments/media-types/index.htm">IANA MIME </a>
    782 
    783 </p>
    784 <p>
    785      URI
    786 {@link android.content.ContentProvider#getType(Uri) getType()}  Android  MINE  MIME 
    787 
    788 </p>
    789 <ul>
    790     <li>
    791         <code>vnd</code>
    792     </li>
    793     <li>
    794         
    795         <ul>
    796             <li>
    797      URI <code>android.cursor.<strong>item</strong>/</code>
    798             </li>
    799             <li>
    800      URI <code>android.cursor.<strong>dir</strong>/</code>
    801             </li>
    802         </ul>
    803     </li>
    804     <li>
    805         <code>vnd.&lt;name&gt;</code>.<code>&lt;type&gt;</code>
    806         <p>
    807              <code>&lt;name&gt;</code>  <code>&lt;type&gt;</code>
    808             <code>&lt;name&gt;</code>  <code>&lt;type&gt;</code>  URI 
    809 
    810  Android  <code>&lt;name&gt;</code>
    811  
    812 <code>&lt;type&gt;</code> URI 
    813 
    814         </p>
    815 
    816     </li>
    817 </ul>
    818 <p>
    819      
    820 <code>com.example.app.provider</code> 
    821 <code>table1</code>  <code>table1</code>  MIME 
    822 </p>
    823 <pre>
    824 vnd.android.cursor.<strong>dir</strong>/vnd.com.example.provider.table1
    825 </pre>
    826 <p>
    827      <code>table1</code>  MIME 
    828 </p>
    829 <pre>
    830 vnd.android.cursor.<strong>item</strong>/vnd.com.example.provider.table1
    831 </pre>
    832 <h3 id="FileMIMETypes"> MIME </h3>
    833 <p>
    834     
    835 {@link android.content.ContentProvider#getStreamTypes(Uri, String) getStreamTypes()}
    836      URI  MIME  {@link java.lang.String} MIME  MIME  MIME 
    837 
    838 
    839 </p>
    840 <p>
    841      <code>.jpg</code>
    842 <code>.png</code>  <code>.gif</code> 
    843      <code>image/*</code> ()  {@link android.content.ContentResolver#getStreamTypes(Uri, String)
    844 ContentResolver.getStreamTypes()} {@link android.content.ContentProvider#getStreamTypes(Uri, String)
    845 ContentProvider.getStreamTypes()} 
    846 
    847 
    848 </p>
    849 <pre>
    850 { &quot;image/jpeg&quot;, &quot;image/png&quot;, &quot;image/gif&quot;}
    851 </pre>
    852 <p>
    853      <code>.jpg</code>  <code>*\/jpeg</code>  {@link android.content.ContentResolver#getStreamTypes(Uri, String)
    854 ContentResolver.getStreamTypes()} {@link android.content.ContentProvider#getStreamTypes(Uri, String)
    855 ContentProvider.getStreamTypes()} 
    856 
    857 
    858 <pre>
    859 {&quot;image/jpeg&quot;}
    860 </pre>
    861 <p>
    862      MIME 
    863  {@link android.content.ContentProvider#getStreamTypes(Uri, String) getStreamTypes()}  <code>null</code>
    864 
    865 </p>
    866 
    867 
    868 <!--  Implementing a Contract Class -->
    869 <h2 id="ContractClass"></h2>
    870 <p>
    871      <code>public final</code> URIMIME 
    872  URI
    873 
    874 
    875 
    876 </p>
    877 <p>
    878      URI 
    879  Javadoc 
    880  Eclipse  Javadoc
    881 
    882 
    883 </p>
    884 <p>
    885      <code>.jar</code> 
    886 
    887 </p>
    888 <p>
    889     {@link android.provider.ContactsContract} 
    890 
    891 </p>
    892 <h2 id="Permissions"></h2>
    893 <p>
    894      Android <a href="{@docRoot}guide/topics/security/security.html"></a>
    895 
    896     <a href="{@docRoot}guide/topics/data/data-storage.html"></a>
    897 
    898     
    899 </p>
    900 <ul>
    901     <li>
    902         
    903 
    904     </li>
    905     <li>
    906          {@link android.database.sqlite.SQLiteDatabase} 
    907 
    908     </li>
    909     <li>
    910         <em></em><em></em>
    911  API 
    912 
    913     </li>
    914     <li>
    915         // SQLite 
    916 
    917 
    918 
    919 
    920 
    921     </li>
    922 </ul>
    923 <p>
    924     SQLite ()
    925 
    926 
    927 </p>
    928 <h3></h3>
    929 <p>
    930     
    931  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
    932     &lt;provider&gt;</a></code> 
    933 
    934 
    935 
    936 </p>
    937 <p>
    938      <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">
    939     &lt;permission&gt;</a></code> 
    940 
    941  <code><a href="{@docRoot}guide/topics/manifest/permission-element.html#nm">
    942     android:name</a></code>  Java 
    943  
    944 <code>com.example.app.provider.permission.READ_PROVIDER</code>
    945 
    946 </p>
    947 <p>
    948     
    949 
    950     
    951 </p>
    952 <dl>
    953     <dt>
    954         
    955     </dt>
    956     <dd>
    957          <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
    958         &lt;provider&gt;</a></code>  
    959 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#prmsn">
    960         android:permission</a></code> 
    961 
    962     </dd>
    963     <dt>
    964         
    965     </dt>
    966     <dd>
    967          <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
    968         &lt;provider&gt;</a></code> 
    969  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#rprmsn">
    970         android:readPermission</a></code>  
    971 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#wprmsn">
    972         android:writePermission</a></code> 
    973  
    974 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#prmsn">
    975         android:permission</a></code> 
    976     </dd>
    977     <dt>
    978         
    979     </dt>
    980     <dd>
    981          URI /
    982  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
    983         &lt;provider&gt;</a></code> 
    984  <code><a href="{@docRoot}guide/topics/manifest/path-permission-element.html">
    985         &lt;path-permission&gt;</a></code>  URI
    986  URI/
    987 /
    988 
    989 
    990     </dd>
    991     <dt>
    992         
    993     </dt>
    994     <dd>
    995         
    996 
    997 
    998 
    999 
   1000 
   1001         <p>
   1002             
   1003 
   1004  URI 
   1005  URI 
   1006 
   1007 
   1008 
   1009 
   1010         </p>
   1011         <p>
   1012             
   1013  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
   1014             &lt;provider&gt;</a></code> 
   1015  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn">
   1016             android:grantUriPermissions</a></code> 
   1017  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
   1018             &lt;provider&gt;</a></code> 
   1019  <code><a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">
   1020             &lt;grant-uri-permission&gt;</a></code>  URI  URI  {@link android.content.Context#revokeUriPermission(Uri, int)
   1021 Context.revokeUriPermission()}
   1022 
   1023 
   1024         </p>
   1025         <p>
   1026             
   1027              <code>true</code>
   1028 
   1029 
   1030         </p>
   1031         <p>
   1032              <code>false</code>
   1033  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
   1034             &lt;provider&gt;</a></code> 
   1035  <code><a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">
   1036             &lt;grant-uri-permission&gt;</a></code>  URI
   1037 
   1038         </p>
   1039         <p>
   1040              
   1041 {@link android.content.Intent#FLAG_GRANT_READ_URI_PERMISSION}  
   1042 {@link android.content.Intent#FLAG_GRANT_WRITE_URI_PERMISSION}  
   1043 {@link android.content.Intent#setFlags(int) setFlags()} 
   1044         </p>
   1045         <p>
   1046              <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn">
   1047             android:grantUriPermissions</a></code> 
   1048  <code>false</code>
   1049         </p>
   1050     </dd>
   1051 </dl>
   1052 
   1053 
   1054 
   1055 <!-- The Provider Element -->
   1056 <h2 id="ProviderElement">&lt;provider&gt; </h2>
   1057 <p>
   1058      {@link android.app.Activity}  {@link android.app.Service} 
   1059  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
   1060     &lt;provider&gt;</a></code>  {@link android.content.ContentProvider} Android 
   1061 
   1062 
   1063 
   1064 <dl>
   1065     <dt>
   1066         
   1067         (<a href="{@docRoot}guide/topics/manifest/provider-element.html#auth">{@code
   1068         android:authorities}</a>)
   1069     </dt>
   1070     <dd>
   1071         <a href="#ContentURI"> URI</a>
   1072 
   1073 
   1074     </dd>
   1075     <dt>
   1076         
   1077         (<code>
   1078 <a href="{@docRoot}guide/topics/manifest/provider-element.html#nm">android:name</a>
   1079         </code>)
   1080     </dt>
   1081     <dd>
   1082          {@link android.content.ContentProvider} <a href="#ContentProvider"> ContentProvider </a>
   1083 
   1084 
   1085     </dd>
   1086     <dt>
   1087         
   1088     </dt>
   1089     <dd>
   1090         
   1091 
   1092         <ul>
   1093             <li>
   1094                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn">
   1095                 android:grantUriPermssions</a></code>
   1096             </li>
   1097             <li>
   1098                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#prmsn">
   1099                 android:permission</a></code>/
   1100             </li>
   1101             <li>
   1102                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#rprmsn">
   1103                 android:readPermission</a></code>
   1104             </li>
   1105             <li>
   1106                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#wprmsn">
   1107                 android:writePermission</a></code>
   1108             </li>
   1109         </ul>
   1110         <p>
   1111             <a href="#Permissions"></a>
   1112 
   1113 
   1114         </p>
   1115     </dd>
   1116     <dt>
   1117         
   1118     </dt>
   1119     <dd>
   1120          Android 
   1121 
   1122         <ul>
   1123             <li>
   1124                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#enabled">
   1125                 android:enabled</a></code>
   1126             </li>
   1127               <li>
   1128                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#exported">
   1129                 android:exported</a></code>
   1130             </li>
   1131             <li>
   1132                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#init">
   1133                 android:initOrder</a></code> ()
   1134 
   1135             </li>
   1136             <li>
   1137                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#multi">
   1138                 android:multiProcess</a></code>
   1139 
   1140             </li>
   1141             <li>
   1142                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#proc">
   1143                 android:process</a></code>
   1144 
   1145             </li>
   1146             <li>
   1147                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#sync">
   1148                 android:syncable</a></code>
   1149 
   1150             </li>
   1151         </ul>
   1152         <p>
   1153             
   1154  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
   1155             &lt;provider&gt;</a></code> 
   1156 
   1157         </p>
   1158     </dd>
   1159     <dt>
   1160         
   1161     </dt>
   1162     <dd>
   1163         
   1164         <ul>
   1165             <li>
   1166                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#icon">
   1167                 android:icon</a></code>
   1168                  ([]<em></em> &gt; []<em></em> &gt; []<em></em>) 
   1169 
   1170             </li>
   1171             <li>
   1172                 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#label">
   1173                 android:label</a></code>
   1174  ([]<em></em> &gt; []<em></em> &gt; []<em></em>) 
   1175 
   1176             </li>
   1177         </ul>
   1178         <p>
   1179             
   1180  <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">
   1181             &lt;provider&gt;</a></code> 
   1182         </p>
   1183     </dd>
   1184 </dl>
   1185 
   1186 <!-- Intent Access -->
   1187 <h2 id="Intents"></h2>
   1188 <p>
   1189      {@link android.content.Intent} 
   1190      {@link android.content.ContentResolver}  
   1191 {@link android.content.ContentProvider}  Activity ( Activity ) 
   1192  Activity  UI  Activity 
   1193 
   1194 
   1195      Activity  UI 
   1196 
   1197 
   1198 </p>
   1199 <p>
   1200 
   1201 </p>
   1202 <p>
   1203     
   1204 
   1205 
   1206 
   1207      UI 
   1208 
   1209 </p>
   1210 <p>
   1211     
   1212 <a href="{@docRoot}guide/components/intents-filters.html"></a>
   1213 
   1214 </p>
   1215