Java中预期的方法调用

时间:2017-05-07 12:46:55

标签: java android

任何人都可以指出我的程序中缺少或不正确的代码行,这是我正在使用的代码。顺便提前感谢那些愿意帮助的人。这是预期错误'方法调用的代码行。总是弹出。

int Lenght = 10;
for(int i = 0; i < Length; i ++)
{
    // this loop iterate through all values
    // lets say at i = 5, I want the loop to repeat until conition (x) is met 
    // before continuing to other iterations
    if(i == 5)
    {   // For example sake assuming x is an int and 10 is your exit val
        // Post more code for a better answer
        while (x != 10)
        {
            x++;
        }
}

您可以在下面看到完整的代码。

 View v = layoutInflater.inflate(layouts(position),container,false);

1 个答案:

答案 0 :(得分:0)

layouts是一个int数组,因此您应该将索引放入[]括号中。当用户将参数放入方法时,将使用()

示例:

arrayList.add(item);

正确的代码:

View v = layoutInflater.inflate(layouts[position], container, false);