Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i=0; i< ll_p4_l.getChildCount(); i++){
- final int nr = i + 1;
- Button b = (Button) ll_p4_l.getChildAt(i);
- b.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- doEvaluation(nr);
- }
- });
- }
- ------------------------------------------
- Button[][][] bFieldPos = {
- { {b1_l1, b1_l2, b1_l3, b1_l4 },{b1_r1, b1_r2, b1_r3, b1_r4 } },
- { {b2_l1, b2_l2, b2_l3, b2_l4 },{b2_r1, b2_r2, b2_r3, b2_r4 } },
- { {b3_l1, b3_l2, b3_l3, b3_l4 },{b3_r1, b3_r2, b3_r3, b3_r4 } },
- { {b4_l1, b4_l2, b4_l3, b4_l4 },{b4_r1, b4_r2, b4_r3, b4_r4 } },
- { {b5_l1, b5_l2, b5_l3, b5_l4 },{b5_r1, b5_r2, b5_r3, b5_r4 } },
- { {b6_l1, b6_l2, b6_l3, b6_l4 },{b6_r1, b6_r2, b6_r3, b6_r4 } },
- { {bSt_l1, bSt_l2, bSt_l3, bSt_l4 }, {} },
- { {bDia_l1, bDia_l2, bDia_l3, bDia_l4 }, {} }
- };
- LinearLayout ll_p1, ll_p2, ll_p3, ll_p4, ll_p5, ll_p6, ll_pSt, ll_pDia;
- LinearLayout[] linearlayout_pos = { ll_p1, ll_p2, ll_p3, ll_p4, ll_p5, ll_p6, ll_pSt, ll_pDia };
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.ingame);
- linearlayout_pos[0] = (LinearLayout) findViewById(R.id.ll_p1);
- linearlayout_pos[1] = (LinearLayout) findViewById(R.id.ll_p2);
- linearlayout_pos[2] = (LinearLayout) findViewById(R.id.ll_p3);
- linearlayout_pos[3] = (LinearLayout) findViewById(R.id.ll_p4);
- linearlayout_pos[4] = (LinearLayout) findViewById(R.id.ll_p5);
- linearlayout_pos[5] = (LinearLayout) findViewById(R.id.ll_p6);
- linearlayout_pos[6] = (LinearLayout) findViewById(R.id.ll_pSt);
- linearlayout_pos[7] = (LinearLayout) findViewById(R.id.ll_pDia);
- for (int n=0; n<linearlayout_pos.length;n++){
- for (int j=0; j < linearlayout_pos[n].getChildCount(); j++){
- for (int i=0; i < ((ViewGroup)(linearlayout_pos[n].getChildAt(j))).getChildCount(); i++){
- bFieldPos[n][j][i] = (Button) findViewById(((ViewGroup)(linearlayout_pos[n].getChildAt(j))).getChildAt(i).getId());
- final int nr = i + 1;
- Button bFieldPos[n][j][i] = (Button) ((ViewGroup)(linearlayout_pos[n].getChildAt(j))).getChildAt(i);
- bFieldPos[n][j][i].setOnClickListener(new OnClickListener()
- {
- public void onClick(View v) {
- doEvaluation(nr);
- }
- });
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment