Also Add Row funktioniert soweit. Ich überlege, ob man die Default werte noch ändert. Default ist es Text, wenn ich es eingebe wird es zum double Wert und es rechnet richtig.
Code
addRowButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Create a new table row.
TableRow tableRow = new TableRow(context);
// Set new table row layout parameters.
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
tableRow.setLayoutParams(layoutParams);
// Add a TextView in the first column.
EditText editText1 = new EditText(context);
editText1.setText("Stück");
tableRow.addView(editText1, 0);
final EditText firstNumber2 = new EditText(context);
firstNumber2.setText("1");
final double[] num1 = new double[1];
//firstNumber2 = (EditText)findViewById(R.id.zahl1gew);
tableRow.addView(firstNumber2, 1);
final double[] sum = new double[1];
final String[] sumstring = new String[1];
final EditText secondNumber2 = new EditText(context);
secondNumber2.setText("1");
final double[] num2 = new double[1];
tableRow.addView(secondNumber2, 2);
final TextView addResult2 = new TextView(context);
addResult2.setText("2");
//final double[] num3 = new double[1];
tableRow.addView(addResult2, 3);
Button button = new Button(context);
button.setText("verkauft");
tableRow.addView(button, 4);
//final TextView addResult;
//addResult = (TextView)findViewById(R.id.zahl1preis);
Alles anzeigen