RX
07/16/2020, 8:00 PMCaused by: java.lang.IllegalStateException: Cannot invoke setValue on a background thread
this is my code written on Java (Im new on Android), someone knows why it’s the problem whit my line?RX
07/16/2020, 8:02 PMValentin Moscone
07/16/2020, 8:07 PMpostValue()
? (i do not know exactly what libraries are you using)Ian Lake
07/16/2020, 8:07 PMdoInBackground()
is, as the name implies, on a background thread. Sounds like you should be returning that object and doing the setValue
in onPostExecute()
which is what runs on the main threadRX
07/16/2020, 8:08 PMIan Lake
07/16/2020, 8:08 PMRX
07/16/2020, 8:10 PMCasey Brooks
07/16/2020, 8:45 PMCasey Brooks
07/16/2020, 8:45 PM.postValue()
to set the value from a background thread and it should work (though I’d consider that a code smell)okarm
07/18/2020, 7:25 PMAsyncTsk
? This thing fell out of favor a good few years ago.
Where did you learn about AsyncTask
? Because that tutorial needs to be taken down.