3

I am working on an application in which I have added an EditField for which the value is fixed for $72.

I have implemented the check at the end of the form but this is not working for me. I need to check this at run-time to check weather user is entering the amount is greater or less then &72.

The value can be in decimal also.

Please suggest me, how can I fix the limit of the EditField to $75.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Sam-In-TechValens
  • 2,501
  • 4
  • 34
  • 67

1 Answers1

0

try the following. It will check for the values as soon as the user changes the focus from the EditText

EditText et = (EditText) findViewById(R.id.your_edittext);

et .setOnFocusChangeListener(new OnFocusChangeListener() {

            @Override
            public void onFocusChange(View view, boolean hasFocus) {
                // TODO Auto-generated method stub
                if (!hasFocus) {
                    // Make your loginc here
                } 
            }
        });
Atif Farrukh
  • 2,219
  • 2
  • 25
  • 47