LoopJ AndroidAsyncHttp下载大文件OOM

时间:2015-01-05 07:58:28

标签: android android-async-http

我需要在Android应用程序中使用LoopJ AndroidAsyncHttp从服务器下载大文件,但是文件的OOM很大。 我用google搜索我发现我需要编写自己的BinaryHttpResponseHandler并修改sendResponseMessage。但是我怎么能这样做呢?我是AsyncHttpClient的新手。有人可以给我一些建议吗?

1 个答案:

答案 0 :(得分:0)

我不确定你是否要求这个。看看http://loopj.com/android-async-http/

AsyncHttpClient client = new AsyncHttpClient();
client.get("http://example.com/file.png", new FileAsyncHttpResponseHandler(/* Context */ this) {
    @Override
    public void onSuccess(int statusCode, Header[] headers, File response) {
        // Do something with the file `response`
    }
});
相关问题