Merhabalar;
Android'de 5X5 lik bir table oluşturan kod parçası aşağıda, fakat hata veriyor, bakalım kim bulacak :) hata ise "Force Close" hatası, ben de bilemiyorum tam olarak yani
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gesture);
int sizey=5;
int sizex=5;
int btnwidth=24;
TableLayout tl = (TableLayout)findViewById(R.id.tblLayout);
for (int y=0; y<sizey; y++){
// Rows
TableRow tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
//Cells
for (int x=0; x<sizex ;x++){
// Create new cell
// new button
Button b = new Button(this);
b.setText(""+x+""+y);
b.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
b.setHeight(btnwidth);
// add button to row
tr.addView(b);
}
// add row to layout
tl.addView(tr,new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
}
}