Reputation: 11
I am making a determinant calculator. This code creates a*a EditText matrix. If I insert numbers in each EditText (in this case "et" in code) I want those numbers into two dimensional array.
I want the data from the matrix, not put in the matrix.
My code is:
public void matrixSize(int a){
ll = (LinearLayout)findViewById(R.id.ll);
Display display = ((WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth()/3;
for(int i=0;i<a;i++){
l = new LinearLayout(this);
l.setOrientation(LinearLayout.HORIZONTAL);
for(int j=0;j<a;j++){
et = new EditText(this);
if (a<=7){
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(150, 150);
l.addView(et,lp);
}
else {
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(100, 100);
l.addView(et,lp);
}
}
ll.addView(l);
}
}
Here is the matrix:
Upvotes: 0
Views: 137