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!
精彩评论