public void playAgain(View view)
{
LinearLayout playAgainLayout = (LinearLayout) findViewById(R.id.playAgainLayout);
playAgainLayout.setVisibility(View.INVISIBLE);
activePlayer = 0;
for (int i=0;i<=8;++i)
{
gameState[i]=2;
}
GridLayout grid = (GridLayout) findViewById(R.id.gridLayout);
for (int i=0;i<=grid.getChildCount();++i)
{
((ImageView) grid.getChildAt(i)).setImageResource(R.drawable.transp);
}
}
答案 0 :(得分:1)
首先,您需要发布异常。第二,问题来自三个部分之一。
grid.getChildAt(i)
可能是null
。grid.getChildAt(i)
可能不是您正在解析的ImageView
(R.drawable.transp)
的地址错误注释整个堆栈跟踪以找出问题。