是否AsyncTask的运行doInBackground相应地它的每一个参数顺序或随机? [英] Does AsyncTask run the doInBackground accordingly to each of its parameter order or randomly?
问题描述
例如有一个的AsyncTask
字符串的... 参数
,如果我做这样的呼吁
For example there is an AsyncTask
of a String... parameters
, if I make a call like this :
AsyncTask<String, Void, Void> someTask = new myTask(myActivity.this);
someTask.execute(string1 , string2 , string3);
什么是执行 doInBackground
的内部秩序这个任务里面的:它把字符串1首则字符串2等sequencely因为他们是所谓的时候提供,或者不它对待参数
随机?
What is the internal order of execution of the doInBackground
inside this task : does it treat string1 first then string2 and so on sequencely as they are provided when called , or does it treat the parameters
randomly ?
推荐答案
字符串...
是一个的可变参数,在这个例子中所有的各个参数转换成的String []
,其中的条目的阵列是他们得到了传递到方法的顺序。
String...
is a "vararg", which in this example converts all individual parameters into a String[]
, where the entries to the array are in the order they got passed into the method.
因此,使用你的榜样,(字符串[])参数[0]
== <$ C C $>字符串1 ,参数[1]
== 字符串2
,参数[2]
== STRING3 等<$ C C $>。这对于参数
项的顺序,至于如何在每个条目参数
时,这完全取决于你的code。
So using your example, (String[]) param[0]
== string1
, param[1]
== string2
, param[2]
== string3
and so forth. This is for the ordering of param
entries, as to how each entry in param
is used, it depends entirely on your code.
这篇关于是否AsyncTask的运行doInBackground相应地它的每一个参数顺序或随机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!