Closed tahaelsherif closed 4 years ago
@tahaelsherif It's look like you already added the view in parent and that code called again after configuration changes. Please supporting the configuration changes in your app to solve this.
If my answer is not related to your issue. Please provide more information about that view.
How do I support the configuration changes in my app ? I'm using both of databinding and mvvm btw.
Please see https://developer.android.com/guide/topics/resources/runtime-changes
This also happen when screen size changed (rotate device). To make sure that problem is about configuration changes, not the library. Please try to open that activity and rotate the device (without android:configChanges attribute in Activity).
All activities are portrait only :)
@tahaelsherif Does not about your app support landscape or not. Just only enable screen orientation for test about your issue. There's many situation for config changes but screen orientation is easy to test.
Ok i will try to test as many usecases as i can and i will let you know.
So finally it was not from your library the issue is caused by fragment inflating, the fragment was attached to the parent view.
This is the old one
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_buy_sell_list, container, true)
And then I changed it to this one
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_buy_sell_list, container, false)
And then everything was fixed anyway thank you for your time maybe you should mention this as a tip for your documentation.
@tahaelsherif I thought that inflate(..., ..., container, false)
is the normal one. Why do you use true
? (Curious only)
Yes it's supposed to be false by default but I changed it to true once for some testing and i forgot to returing it to false before i added your librray , so i didn't know that this was cuasing the problem
App crash when change language inside fragment