Java.lang.IllegalStateException: The application PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged android

前端 未结 6 1556
花落未央
花落未央 2021-02-08 10:00

I am trying to use a static class to pass value to a view instead of using intent as I have to pass a large amount of data. Sometimes I get this error and couldn\'t find out wha

6条回答
  •  野的像风
    2021-02-08 10:30

    Sometimes this error occurs.

    Here is my suggestion:

    In your DataResult->getData()

    return a copy of the data.

    DataResult is a singleton and holds the data. When your view gets the data, the view gets the data reference witch the DataResult is holding. Then setData() would change the data reference. Here comes the IllegalStateException.

    Hope it would work :)

提交回复
热议问题