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 <strings> 23 <intro> 24 <![CDATA[ 25 This sample demonstrates how to use the ContentProvider with paging support introduced 26 in Android O. The ContentProvider now accepts additional arguments for the offset and 27 the limit in the query method to support paging instead of fetching all the data in 28 a single query method call. 29 ]]> 30 </intro> 31 </strings> 32 33 <template src="base-build" /> 34 35 <metadata> 36 <status>PUBLISHED</status> 37 <categories>Content, Android O Preview</categories> 38 <technologies>Android</technologies> 39 <languages>Java</languages> 40 <solutions>Mobile</solutions> 41 <level>INTERMEDIATE</level> 42 <icon>screenshots/icon-web.png</icon> 43 <screenshots> 44 <img>screenshots/screenshot-1.png</img> 45 </screenshots> 46 <api_refs> 47 <android>android.content.ContentProvider</android> 48 <android>android.provider.DocumentsProvider</android> 49 </api_refs> 50 51 <description> 52 <![CDATA[ 53 This sample demonstrates how to use the ContentProvider with paging support introduced 54 in Android O. The ContentProvider now accepts additional arguments for the offset and 55 the limit in the query method to support paging instead of fetching all the data in 56 a single query method call. 57 ]]> 58 </description> 59 60 <intro> 61 <![CDATA[ 62 [ContentProvider][1] and [DocumentsProvider][2] now supports paging instead of fetching the all 63 data at once. 64 65 Starting from Android O, ContentProvider#query(Uri, String[], Bundle, CancellationSignal) and 66 DocumentsProvider#query(Uri, String[], Bundle, CancellationSignal) methods are introduced. 67 The Bundle accepts the keys for ContentResolver.QUERY_ARG_OFFSET as an starting offset and 68 ContentResolver.QUERY_ARG_LIMIT as the number of items included in the returned Cursor object. 69 70 Similarly, the returned Cursor object now has a Bundle object obtained by Cursor#getExtras(). 71 The Bundle is able to include data such as the total size of the underlying data set. 72 73 [1]: https://developer.android.com/reference/android/content/ContentProvider.html 74 [2]: https://developer.android.com/reference/android/provider/DocumentsProvider.html 75 ]]> 76 </intro> 77 </metadata> 78 </sample> 79