当你使用AsyncHttpClient类中new new AsyncHttpResponseHandler()出现java.lang.AssertionError: Cannot create情况时
可能原因
1.根据·
Downloading Binary Data with FileAsyncHttpResponseHandler
The FileAsyncHttpResponseHandler class can be used to fetch binary data such as images and other files. For example:
AsyncHttpClient client = new AsyncHttpClient();
client.get("https://example.com/file.png", new FileAsyncHttpResponseHandler(/* Context */ this) {
@Override
public void onSuccess(int statusCode, Header[] headers, File response) {
// Do something with the file `response`
}
});
See the FileAsyncHttpResponseHandler Javadoc for more information.
由上面可知:FileAsyncHttpResponseHandler(/*Con text*/ this) 括号里放的是上下文,我是在这里放了个new file(),可是没有执行创建file任务,就出现java.lang.AssertionError错误,改为this才行可是,我还不知道文件到底如何通过file存放,求告知
求告知。

浙公网安备 33010602011771号