我正在使用 android 上的异步下载文件,现在我希望这些文件显示在活动中。如何在 onSucess 方法中执行此操作?我尝试了以下方法,但图像未显示!
AsyncHttpClient fileDownload = new AsyncHttpClient();
String[] allowedContentTypes = new String[] { "image/png", "image/jpeg" };
fileDownload.get("http://server.com/file.png", new BinaryHttpResponseHandler(allowedContentTypes) {
@Override
public void onSuccess(byte[] fileData) {
//Do Something here to view files in activity
ImageView img = (ImageView) findViewById (R.id.imageview1);
}