blob: df13e50a7830a48565b0f4105a8a0ef80516be60 [file] [log] [blame]
Takeshi Hagikura0dca3822017-03-10 11:35:17 +09001<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2017 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<sample>
18 <name>ContentProviderPaging</name>
19 <group>UI</group>
20 <package>com.example.android.contentproviderpaging</package>
21
22 <minSdk>"android-O"</minSdk>
23
24 <strings>
25 <intro>
26<![CDATA[
27This sample demonstrates how to use the ContentProvider with paging support introduced
28in Android O. The ContentProvider now accepts additional arguments for the offset and
29the limit in the query method to support paging instead of fetching all the data in
30a single query method call.
31]]>
32 </intro>
33 </strings>
34
35 <template src="base-build" />
36
37 <metadata>
38 <status>PUBLISHED</status>
39 <categories>Content, Android O Preview</categories>
40 <technologies>Android</technologies>
41 <languages>Java</languages>
42 <solutions>Mobile</solutions>
43 <level>INTERMEDIATE</level>
44 <icon>screenshots/icon-web.png</icon>
45 <screenshots>
46 <img>screenshots/screenshot-1.png</img>
47 </screenshots>
48 <api_refs>
49 <android>android.content.ContentProvider</android>
50 <android>android.provider.DocumentsProvider</android>
51 </api_refs>
52
53 <description>
54<![CDATA[
55This sample demonstrates how to use the ContentProvider with paging support introduced
56in Android O. The ContentProvider now accepts additional arguments for the offset and
57the limit in the query method to support paging instead of fetching all the data in
58a single query method call.
59]]>
60 </description>
61
62 <intro>
63<![CDATA[
64[ContentProvider][1] and [DocumentsProvider][2] now supports paging instead of fetching the all
65data at once.
66
67Starting from Android O, ContentProvider#query(Uri, String[], Bundle, CancellationSignal) and
68DocumentsProvider#query(Uri, String[], Bundle, CancellationSignal) methods are introduced.
69The Bundle accepts the keys for ContentResolver.QUERY_ARG_OFFSET as an starting offset and
70ContentResolver.QUERY_ARG_LIMIT as the number of items included in the returned Cursor object.
71
72Similarly, the returned Cursor object now has a Bundle object obtained by Cursor#getExtras()
73and the Bundle object has the number of total size of the underlying data set, which can be
74retrieved for the ContentResolver#EXTRA_TOTAL_SIZE key.
75
76[1]: https://developer.android.com/reference/android/content/ContentProvider.html
77[2]: https://developer.android.com/reference/android/provider/DocumentsProvider.html
78]]>
79 </intro>
80 </metadata>
81</sample>