Advertisement
Guest User

Untitled

a guest
Dec 6th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1.     View.OnFocusChangeListener amountOnFocusChangeListener = new View.OnFocusChangeListener() {
  2.         @Override
  3.         public void onFocusChange(View v, boolean hasFocus) {
  4.             if (!hasFocus) {
  5.                 rawInput = amount_test.getText().toString();
  6.                 Locale dutch = new Locale("nl", "NL");
  7.                 NumberFormat numberFormatDutch = NumberFormat.getCurrencyInstance(dutch);
  8.                 String formattedAmount = numberFormatDutch.format(new BigDecimal(rawInput));
  9.                 amount_test.setText(formattedAmount);
  10.             } else {
  11.                 if (rawInput != null) {
  12.                     amount_test.setText(rawInput);
  13.                 }
  14.             }
  15.         }
  16.     };
  17.     amount_test.setOnFocusChangeListener(amountOnFocusChangeListener);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement