How do I know when my edit text is done being edited? Like when the user selects the next box, or presses the done button on the soft keyboard.
My Code is Here
EditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View arg0, boolean arg1) {
int tag=(Integer) arg0.getTag();
final EditText Caption = (EditText) arg0;
previous_Meter_Reading = new HashMap<String, String>();
previous_Meter_Reading = c.get(tag);
String pre =previous_Meter_Reading.get("previousMeterReading");
previous =Integer.parseInt(pre);
Log.i("out",pre);
if (!arg1 && ! Caption.getText().toString().equals("")) {
int pos=arg0.getId();
Log.i("Tag", arg0.getTag().toString());
Current = Integer.valueOf(Caption.getText().toString());
if(Current<previous){
AlertDialog.Builder builder = new AlertDialog.Builder(
context);
builder.setTitle("WARNING");
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setMessage("Current value should be greater");
builder.setPositiveButton("ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
AlertDialog diag = builder.create();
diag.show();
}
Toast.makeText(context, "Focus Changed",Toast.LENGTH_SHORT);
}
} });
return view;
}
after each character is entered my alertbox is popup. basically i want to get input text when i change the focus to next EditText box and get the value of lost focus edittext and compare with prevoius value can any one give any solution for that Thanks in advance.