找到你要的答案

Q:StackOverFlowError with recursive and callback in Android

Q:堆栈溢出错误的递归和回调在Android

ArrayList<User> users = User.getAll();
int n = users.size();
private void dowload(int i){
    if(i >= n) return;
    Sync.download(i, new OnDownloadListener(){
        public void done(Data data){
            data.save();
            download(i+1);
        }
    });
}

I have the function download with recursive when i run download(0) the StackOverFlowError was thrown. I have a user list, each user have a few data info and it's downloaded from internet. The user list is stored in my database, i will load all user and call download user data as below, i need to download partials, ex download done for user data 1 and next to user data 2... etc. Have someone give me a suggest to resolve it. Thanks.

ArrayList<User> users = User.getAll();
int n = users.size();
private void dowload(int i){
    if(i >= n) return;
    Sync.download(i, new OnDownloadListener(){
        public void done(Data data){
            data.save();
            download(i+1);
        }
    });
}

我用递归函数下载当我运行下载(0)的堆栈溢出错误被。我有一个用户列表,每个用户有一些数据信息,并从互联网上下载。用户列表存储在我的数据库,我将所有的用户和电话下载用户数据如下,我需要下载部分下载完成,前1的用户数据和用户数据的2个…有人给我一个建议来解决它。谢谢.

android  recursion  callback