如何使用异步任务的返回值执行方法?

How to execute the method with returned value from an asynctask?

A方法用于Custom View,Asnyctask B用于获取URL。 要从 Asynctask 使用 returned URL 在自定义视图上加载图像,我需要在异步任务之后执行自定义视图方法。 当我在 asynctask 之后调用该方法时,该方法变为 null,因为 asynctask 还没有 return 值。 我该如何处理这个问题?

customView= findViewById(R.id.custom_view);
UrlRequest urlRequest = new UrlRequest(this).build(); // AsyncTask
customView.loadImg(urlRequest); // null value

首先在 Logcat 上 customView.loadImg 方法 运行,然后 return 编辑 urlRequest。

我期望 returned 数据,但实际输出为空...

也许检查 this。它的工作方式应该与 awaitc# 中的工作方式相同。我不太确定