https://kotlinlang.org logo
#android
Title
# android
j

Johncarloespiritu

06/07/2019, 12:05 PM
hello there can someone help me here, im newbie in kotlin
g

gildor

06/07/2019, 1:13 PM
Help with what exactly? Please, add some context or at least question. Also, pesase, use backticks
` to format your code:
Copy code
like this
🙏 2
f

Filip Zych

06/08/2019, 10:16 AM
It seems like you are using only one method that AsyncTask provides. Also you are trying to update ui thread after job is done ( in your case it's a network call) and for that a perfect method that you might consider is onPostExecute. Also because you are using .execute() it blocks the thread but as far as I remember using Call.enqueue() will do it in the background for you, so basically there is no need to use AsyncTask here to make that call. So to sum it up. Extract that what you have in doInBackGround method to a method. Then make the call by using Call.enqueue() for better error handling. Then update your ui according to the result you get.
2 Views