I'm writing the application that has to display to a user a dynamically created table of EditText widgets.
My current code:
/**
* Create and display the table of EditTexts on the screen
* @param x Number of columns
* @param y Number of rows
*/
private void createTable(int x, int y) {
TableLayout table = (TableLayout) findViewById(R.id.TableLayout01);
etGrid = new EditText[y][x];
for (int i = 0; i < y; i++) {
TableRow row = new TableRow(this);
for (int j = 0; j < x; j++) {
EditText et = new EditText(this);
et.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
| InputType.TYPE_NUMBER_FLAG_SIGNED);
et.setSingleLine();
et.setMinimumWidth(getWindowManager().getDefaultDisplay().getWidth()/x);
etGrid[i][j] = et;
row.addView(et);
}
table.addView(row,new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
}
The problem is in this line, which doesn't work at all:
et.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
| InputType.TYPE_NUMBER_FLAG_SIGNED);
On my Kindle Fire I can either restrict to decimal values with InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
or signed with InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED
, but not to signed decimal. What is the problem with the code?