1 <?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[ 27 This sample demonstrates how to use the ContentProvider with paging support introduced 28 in Android O. The ContentProvider now accepts additional arguments for the offset and 29 the limit in the query method to support paging instead of fetching all the data in 30 a 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[ 55 This sample demonstrates how to use the ContentProvider with paging support introduced 56 in Android O. The ContentProvider now accepts additional arguments for the offset and 57 the limit in the query method to support paging instead of fetching all the data in 58 a 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 65 data at once. 66 67 Starting from Android O, ContentProvider#query(Uri, String[], Bundle, CancellationSignal) and 68 DocumentsProvider#query(Uri, String[], Bundle, CancellationSignal) methods are introduced. 69 The Bundle accepts the keys for ContentResolver.QUERY_ARG_OFFSET as an starting offset and 70 ContentResolver.QUERY_ARG_LIMIT as the number of items included in the returned Cursor object. 71 72 Similarly, the returned Cursor object now has a Bundle object obtained by Cursor#getExtras(). 73 The Bundle is able to include data such as the total size of the underlying data set. 74 75 [1]: https://developer.android.com/reference/android/content/ContentProvider.html 76 [2]: https://developer.android.com/reference/android/provider/DocumentsProvider.html 77 ]]> 78 </intro> 79 </metadata> 80 </sample> 81