How can I load the spinner after they finish all the get reponse of androidnetworking?

0

What happens is that I am using the FastAndroidNetworking library and when I perform a get to load the local database (I am using ROOM), it ends after I load the spinner (I am using the MaterialSpinner), in what way I can tell the spinner to wait until the base is finished loading. Here is the code

    
asked by gian gabriel 16.07.2018 в 18:44
source

1 answer

0

In the cargarTodosEquipos() method the onResponse is telling you that it is over, then before your toast "EQUIPOS CARGADOS SATISFACTORIAMENTE" , it will be there to load the spinner

So, get this line from onCreate();

spinner.setItems(db.equipoDao().equipos());

and put it on top of that Toast in the onResponse

spinner.setItems(db.equipoDao().equipos());

What happens is that the onCreate () when executed, executes everything in a single pass, and while the data base is loading, I already execute the spinner code to fill it with data when it does not have, then moving the setting of the spinner to when the database ends loading the data is what should load all the data once finished.

    
answered by 17.07.2018 в 02:17