で 9 つのButton ビューを作成し、main.xmlそれに名前を付けてからButton1, Button2... Button9..、コードでボタンの を作成しました。ArrayListこのボタンの配列が私のボタンを保持main.xmlし、main.xml でボタンを取得するという現在の知識では明らかです。 findViewById メソッドを使用する必要があり、基本的には配列をループしてボタンを取得する必要があります
ArrayList<Button> buttons;
int MAXBTN = 9;
for( int i = 0; i < BTN; i++ )
{
// Code here to use the findViewById method to get the button
}
私の問題はR.id.Button1 .. R.id.Button3、findViewById メソッドに渡す必要があることですが、これをループする必要があります。とにかくfindViewByIdwhileループでカウンターを渡すことができますか?
お知らせ下さい。