我们怎样才能得到doInBackground中传递的参数计数(String ... args)

时间:2017-07-25 17:49:37

标签: android string parameters

我搜索了很多帖子,我的意思是(String ... args),但现在我的问题是如何在函数中获取这些参数的计数。 任何帮助表示赞赏...

1 个答案:

答案 0 :(得分:3)

您可以使用length方法。基本上是Array,因此您可以将其视为Array

  public void doInBackground(String… args) {

    int count = args.length;

}

从索引获取值 - 您可以使用

String value = args[index];