Comments (6)
Hi @LissF, thanks for reporting the problem. I'll try to reproduce it to see where the problem is.
According to the log, it seems like you are using an ObservableList and you are modifying it when you are in that other activity, is it right?
Meanwhile, can you please tell me if that happens also in version 1.1.1?
from lastadapter.
@nitrico, I've updated LastAdapter to 1.2.1. I've also made a lot of development/fixes in my project and I'm not able to reproduce the issue anymore.
I don't think I was changing my ObservableArrayList from another activity. But maybe I change some fields of items of that list in really indirect way. It could be the issue, right? I'll try to fix that behavior. Sorry, I'm new with databinding :)
from lastadapter.
It should be OK to change the items or their fields at any time, just asked to try to reproduce the situation where it happened.
I close the issue as it looks like is not happening anymore but feel free to reopen if it happens again or you have any other question. Thank you.
from lastadapter.
Hello again :)
Got same issue on switching tabs. I have 4 tabs, so fragments got recreated on switch between 1 and 4. This issue happens not all the time but I'm able to reproduce it if I switch between tabs some time. It looks like databinding holds old callback. Is it possible? Maybe I have to add some code to "onDestroyView()" to clear that CallbackRegistry?
java.lang.IllegalStateException: reference.get() must not be null
at com.github.nitrico.lastadapter.WeakReferenceOnListChangedCallback.getAdapter(WeakReferenceOnListChangedCallback.kt:30)
at com.github.nitrico.lastadapter.WeakReferenceOnListChangedCallback.onItemRangeRemoved(WeakReferenceOnListChangedCallback.kt:44)
at android.databinding.ListChangeRegistry$1.onNotifyCallback(ListChangeRegistry.java:54)
at android.databinding.ListChangeRegistry$1.onNotifyCallback(ListChangeRegistry.java:38)
at android.databinding.CallbackRegistry.notifyCallbacks(CallbackRegistry.java:201)
at android.databinding.CallbackRegistry.notifyFirst64(CallbackRegistry.java:122)
at android.databinding.CallbackRegistry.notifyRemainder(CallbackRegistry.java:169)
at android.databinding.CallbackRegistry.notifyRecurse(CallbackRegistry.java:145)
at android.databinding.CallbackRegistry.notifyCallbacks(CallbackRegistry.java:91)
at android.databinding.ListChangeRegistry.notifyCallbacks(ListChangeRegistry.java:135)
at android.databinding.ListChangeRegistry.notifyRemoved(ListChangeRegistry.java:118)
at android.databinding.ObservableArrayList.notifyRemove(ObservableArrayList.java:124)
at android.databinding.ObservableArrayList.clear(ObservableArrayList.java:79)
at my.package.view.MyFragment.onActivityCreated(MyFragment.java:90)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:2083)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1129)
at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1464)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:748)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1632)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1237)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:668)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
at android.support.design.widget.TabLayout$ViewPagerOnTabSelectedListener.onTabSelected(TabLayout.java:2156)
at android.support.design.widget.TabLayout.dispatchTabSelected(TabLayout.java:1138)
at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1132)
at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1105)
at android.support.design.widget.TabLayout$Tab.select(TabLayout.java:1396)
at android.support.design.widget.TabLayout$TabView.performClick(TabLayout.java:1501)
at android.view.View$PerformClick.run(View.java:19881)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
from lastadapter.
OK, it looks like I've fixed it by recreating my ObservableArrayList. Previously I held it in final field and created only once. Now I recreate my ObservableArrayList in "onActivityCreated()" and crash is gone.
from lastadapter.
I found a very similar problem myself. It is "fixed" in version 1.2.2.
And I say "fixed" because this exception won't be thrown anymore (in this new version at least), but I'm not sure if I did the right thing as I think the exception is more related to the way the ObservableList is manipulated and the RecyclerView being attached and detached than the library itself.
If I discover the exact reason and is it is what I mentioned, future versions could throw this exception again as it can help to handle the ObservableList and/or RecyclerView in a more proper way.
from lastadapter.
Related Issues (20)
- First Item of recyclerview not clickable HOT 2
- Mixing version can lead to runtime crashes HOT 4
- How to use payloads refresh single item special element ?
- Changelog for version 2.3.0? HOT 3
- bind ViewModel is better than bind Model HOT 1
- How to Redraw/notifyDatachange when after property value change HOT 2
- How to use more <data></data> and more BR ? HOT 2
- Add the posibilitie to use RealmResult
- How listen item click listener HOT 2
- DataBinderMapperImpl not generated HOT 9
- Crash on LayoutHandler in kotlin HOT 1
- How to add item HOT 1
- AndroidX Support HOT 4
- kapt databinding error HOT 3
- Use DiffUtil to update list content HOT 2
- Support binding to LiveData (pass LifecycleOwner to items)
- Question: How to Set Single Selection Item? HOT 1
- Bind issues after Android Studio 3.2 release HOT 3
- PageableList
- Please move to mavenCentral (JCenter is closing down) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lastadapter.