How to limit EditText to two decimal places

< EditText android:id=”@+id/eWithdrawAmount” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”4dp” android:ems=”10″ android:inputType=”numberDecimal” >

etInput= (EditText) v.findViewById(R.id.etInput);

etInput.addTextChangedListener(new TextWatcher () {

@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

}

@Override
public void afterTextChanged(Editable edt) {

String temp = edt . toString ();
int posDot = temp . indexOf ( “.” );

if (posDot <= 0) { return ; } if (temp . length () – posDot – 1 > 2) {
edt . delete(posDot + 3, posDot + 4);
}
}
});