Issue
A method is for Custom View, and Asnyctask B is for getting URL. To load an image on Custom View with returned URL from Asynctask, I need to execute Custom View method after the asynctask. When I call the method after asynctask, the method gets null because asynctask didnt return the value yet. How can I handle this problem?
customView= findViewById(R.id.custom_view);
UrlRequest urlRequest = new UrlRequest(this).build(); // AsyncTask
customView.loadImg(urlRequest); // null value
On Logcat, customView.loadImg method run first, then urlRequest is returned.
I expect the returned data, but the actual output is null...
Solution
Maybe check this out. It should work the same way as await
does in c#
. I am not completely sure tho
Answered By - JieBaef
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.