Size: a a a

Android Developers

2020 March 31

V

Valentin in Android Developers
make your properties private
источник

J

Jhamil in Android Developers
Valentin
make your properties private
i think i am doing that take a look inside the filter method
источник

J

Jhamil in Android Developers
Valentin
And for the second, you should update you data form your callback (onDataChange). So, inside your Adapter class create update method, which calls notifyDataSetChange, like this(for example):

fun updateData(newData: ArrayList<String>) {
       itemsExample = newData
       notifyDataSetChanged()
   }

(it's kotlin, but if you have any questions - ask)
i meant this
источник

V

Valentin in Android Developers
oh, how long haven't i worked with filter :D
источник

V

Valentin in Android Developers
Jhamil
i think i am doing that take a look inside the filter method
Does it work?
источник

J

Jhamil in Android Developers
Valentin
Does it work?
the filter code works but the published results seems to be the problem i honestly cannot track what causes the adapter to display wrong data. I logged the filtered data going inside the mFilteredList and it seems to be accurate but after getting passed idk what happens.
источник

J

Jhamil in Android Developers
Here is the filter
источник

QH

Quantum Harmonizer in Android Developers
Jhamil
idk what is stack trace but here the error log, i knew it will crash since the list is not yet populated
So learn basic Java before jumping into Android and try googling error message before asking in a chat.
источник

V

Valentin in Android Developers
жестоко как-то
источник

J

Jhamil in Android Developers
Quantum Harmonizer
So learn basic Java before jumping into Android and try googling error message before asking in a chat.
i understand the error here, i already told him it would cause me a crash if i'd place the adapter initialization before the firebase code
источник

QH

Quantum Harmonizer in Android Developers
Valentin
жестоко как-то
Жестоко спрашивать, что такое нпе, и 10 скриншотов высирать
источник

V

Valentin in Android Developers
:D
источник

V

Valentin in Android Developers
селф-лёрнинг, бывает
источник

V

Valentin in Android Developers
Ему, по факту, надо просто обновлять его список через коллбек, а он создавал для этого несколько адаптеров, когда дата менялась
источник

V

Valentin in Android Developers
Ну бывает же, че
источник

V

Valentin in Android Developers
Jhamil
i understand the error here, i already told him it would cause me a crash if i'd place the adapter initialization before the firebase code
how do you get new data for your adapter?
источник

J

Jhamil in Android Developers
After being filtered the new arraylist data is then saved again to mFilteredList preceeded with notifyDataSetChanged
источник

V

Valentin in Android Developers
how do you get your unfiltered data?
источник

J

Jhamil in Android Developers
firebase? using model? ArrayList<MyModel>?
источник

V

Valentin in Android Developers
Jhamil
you have heroes list, and filteredList.
the first - you have to get heroeslist. You have to create something like this:
private void updateData(newData: ArrayList<String>) {
       itemsExample = newData;
       notifyDataSetChanged();
   }

and call it from onDataChange
источник