开发者

android async task

开发者 https://www.devze.com 2023-01-30 06:45 出处:网络
I have a app I\'m making with an AsyncTask. The result of the task needs to be assigned to a variable in the base app class. I currently have:

I have a app I'm making with an AsyncTask. The result of the task needs to be assigned to a variable in the base app class. I currently have:

    protected void onPostExecute(int[][]... end) {
        MainVar=end[0];
    }

but this doesn't transfer the data. I'm guessing I'm going about this wrong, but I wasn't sure开发者_StackOverflow中文版 how to do it reading the docs, so how should this be done?


It's generally right what you tried. You're given the result of the type int[][] in onPostExecute(). But don't use primitive types. AsyncTask Extensions are generic and need three types: AsyncTask<Params, Progress, Result> which may be Void or anything else (but no primitive data type). Hope that helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消