How to clear/remove all items in page list adapter

android paging library remove item
android pagedlist update item
convert list to pagedlist android
android pagedlist add item
pagedlist java
pagedlist sublist
android pagedlistadapter
paging library android kotlin

I'm using the android paging library to show search result items, is there any way I can clear/remove all the loaded result items, Calling Invalidate on live Paged List refreshing the list not clear/remove items

In Activity: 
 fun clearSearchResult() {
        if (productSearchResultItemAdapter.itemCount > 0) {

In ViewModel
 private fun searchProductByTerm(searchTerm: String): Listing<Item> {
        sourceFactory = ProductSearchItemDataSourceFactory(productSearchUC, compositeDisposable, searchTerm, resourceResolver)

        val livePagedList = LivePagedListBuilder(sourceFactory, pagedListConfig)
                //The executor used to fetch additional pages from the DataSource

        return Listing(
                pagedList = livePagedList,
                networkState = switchMap(sourceFactory.sourceLiveData) {
                retry = {


    fun invalidateResultList() {

private val productSearchName = MutableLiveData<String>()
    private val repoResult = map(productSearchName) {

submitting null clear the currently loaded page list


How to remove an item from PagedListAdapter in Android Paging , Fyi, whole list is returned Everytime whether you add/remove/update any item at any position, but the PagedListAdapter is smart enough to� Avoid deleting your items in a for loop and calling notifyDataSetChanged in every iteration. Instead just call the clear method in your list myList.clear(); and then notify your adapter. public void clearData() { myList.clear(); // clear list mAdapter.notifyDataSetChanged(); // let your adapter know about the changes and reload view.

In Java:

I cleared all items on in PagedListAdapter by calling invalidate() on DataSource instance like that

public void clear(){

Add this method in your ViewModel then call it in your activity


Then Load any data you want

You can see how I made it in my project.

Here is the Link:

How to delete/remove PagedListAdapter item � Issue #281 � android , I can add/remove items from the list, but when I add some ite. Any way to refresh the recyclerview's state to invalidate the new items? try pagelist? Examples. The following example demonstrates the Clear method and various other properties and methods of the List<T> generic class. The Clear method is used at the end of the program, to remove all items from the list, and the Capacity and Count properties are then displayed.

Before invalidate, clear your list data item. Like we did in simple way:


Paging sample update list after add/remove item � Issue #390 , The user sees a list of items and can scroll through them. to remove all elements in its underlying data structure with the clear() method call. To delete your List: Go to Your Lists and select the list you want to delete.; On the list menu (), click Manage Lists.; Click Delete.; Click Save Changes in the Manage Lists window to confirm.

PagedList, ItemAnimator will animate ViewGroup modifications such as add/delete/select that are notified to the Next, we can define the layout for each item within our list. Create a folder for important items, so you won't accidentally delete them.And keep them on other partition, other than the partition in which OS resides(In Windows). Examples of important items include: credit card information, tax information, etc.

Using lists in Android wth ListView - Tutorial, DELETE folderId /children/ childId to true to opt in to API behavior that aims for all items to have exactly one parent. languages (see the client libraries page for a list of supported languages). Drive API for Android � Apps Script � Gmail � Calendar � Admin SDK. To remove items from your Recent view, select the files or folders you want to remove by pointing to each item and clicking the circle check box that appears. On the bar at the top of the page, select Remove. To delete an item in your Recent list, go to the folder in which the item is located.

Using the RecyclerView, This example demonstrate about How to delete all elements from arraylist for listview in AndroidStep 1 − Create a new project in Android Studio� To format the USB drive? No, formatting is a way to remove all existing files on the storage device completely. But when it comes to deleting some specific files only, an ideal way is to delete files on a computer and clear the whole Recycle Bin with the following steps: Step 1. Connect the USB drive to your computer.

  • did you find any working solution for this?
  • This is the solution I was looking for :)
  • I keep getting this error: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position. What can l do about it?
  • can you provide an example how to clear the data in pageList