I'm using TableLayout for my application. I do have 16 buttons (4 rows and 4 columns) inside the layout.
I'm able to assign the text to each button by assigning value to R.id.Button01, 02, 03 .... Button16. Take this as an example code. ((Button)findViewById(R.id.Button01)).setText(list.get (0).toString()); ((Button)findViewById(R.id.Button02)).setText(list.get(1).toString ()); ((Button)findViewById(R.id.Button03)).setText(list.get(2).toString ()); ((Button)findViewById(R.id.Button04)).setText(list.get(3).toString ()); ((Button)findViewById(R.id.Button05)).setText(list.get(4).toString ()); ((Button)findViewById(R.id.Button06)).setText(list.get(5).toString ()); ((Button)findViewById(R.id.Button07)).setText(list.get(6).toString ()); ((Button)findViewById(R.id.Button08)).setText(list.get(7).toString ()); ((Button)findViewById(R.id.Button09)).setText(list.get(8).toString ()); ((Button)findViewById(R.id.Button10)).setText(list.get(9).toString ()); ((Button)findViewById(R.id.Button11)).setText(list.get(10).toString ()); ((Button)findViewById(R.id.Button12)).setText(list.get(11).toString ()); ((Button)findViewById(R.id.Button13)).setText(list.get(12).toString ()); ((Button)findViewById(R.id.Button14)).setText(list.get(13).toString ()); ((Button)findViewById(R.id.Button15)).setText(list.get(14).toString ()); ((Button)findViewById(R.id.Button16)).setText(list.get(15).toString ()); But what I want is similar to following code. for(int i=0; i< 16; i++) { ((Button)findViewById(R.id.Button[i] )).setText(list.get (i).toString()); } Thanks, -Anil --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---