# LibGDX : Textfield input type

I want to change TextField input type . When I click on the textfield the android keyboard appears with all the symbols , but I want only numbers and dot (.) .

TextFieldStyle textFieldStyle = new TextFieldStyle(font_38, Color.valueOf("646b6c"), getDrawable(atlas.findRegion("textField_cursor")), getDrawable(atlas.findRegion("textField_selection")), getDrawable(atlas.findRegion("textField_bg")));
TextField textField = new TextField("", textFieldStyle);
textField .setTextFieldFilter(new TextFieldFilter.DigitsOnlyFilter());


I have done in this way but here the only inputs are numbers and there is no dot . And when I click on the textfield again android keyboard appears with all the symbols , but I can type only numbers . There is a keyboard in android only with numbers , how to open it instead of all the symbols keyboard and type numbers and dot?

I found out a solution to your other problem. To allow the typing of a dot you should create your own implementation of TextFieldFilter like this.

public class DigitFilter implements TextFieldFilter {

private char[] accepted;

public DigitFilter() {
accepted = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.'};
}

@Override
public boolean acceptChar(TextField textField, char c) {
for (char a : accepted)
if (a == c) return true;
return false;
}}


This simple solution should work with any kind of input you may want to allow.