Size: a a a

Android Developers

2020 March 31

V

Valentin in Android Developers
Every time, when your data was changed, you got a new Adapter instance, that's incorrect
источник

К

Кирилл in Android Developers
Jhamil
Inside the for each loop?
источник

V

Valentin in Android Developers
The better way for me, it's private class' property
источник

J

Jhamil in Android Developers
Valentin
Every time, when your data was changed, you got a new Adapter instance, that's incorrect
I see thank you i will work with this information! Glad i got someone to ask. Im self learning sorry.
источник

V

Valentin in Android Developers
But if you use adapter only once, this is better
источник

J

Jhamil in Android Developers
Valentin
But if you use adapter only once, this is better
Isn't this gonna get me error since the list is not populated yet
источник

К

Кирилл in Android Developers
no
источник

J

Jhamil in Android Developers
But I'll try it thanks anyway.
источник

К

Кирилл in Android Developers
Make list in your adapter public so you can change it  in your activity or make get and set functions to your list and change list in OnDataChange + notifyDataSetChange
источник

J

Jhamil in Android Developers
источник

J

Jhamil in Android Developers
Also another thing
источник

V

Valentin in Android Developers
try requireContext()
источник

J

Jhamil in Android Developers
I am quite unfamiliar why it gives me warning i can either set it to getActivity() or getContext() i am using fragment
источник

V

Valentin in Android Developers
Did you move adapter creation from onDataChange?
источник

J

Jhamil in Android Developers
Valentin
Did you move adapter creation from onDataChange?
Yes it crashes
источник

V

Valentin in Android Developers
recycler.setAdapter
источник

V

Valentin in Android Developers
Move it too
источник

V

Valentin in Android Developers
And create inside your adapter class method, which calls notifyDataSetChange
источник

J

Jhamil in Android Developers
Valentin
recycler.setAdapter
i moved it
источник

J

Jhamil in Android Developers
it causes crash
источник