This is my MainActivity, button and onclick function:
public class MainActivity extends AppCompatActivity {
EditText etName;
Button btSubmit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etName = findViewById(R.id.et_name);
btSubmit = findViewById(R.id.bt_submit);
AwesomeValidation awesomeValidation = new AwesomeValidation(ValidationStyle.BASIC);
awesomeValidation.addValidation(this, R.id.et_name, RegexTemplate.NOT_EMPTY, R.string.invalid_name);
btSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openSubActivityEmty();
if (awesomeValidation.validate()) {
//On success
Toast.makeText(getApplicationContext(), "Form Validate Succefull..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Submit faild!", Toast.LENGTH_SHORT).show();
}
}
});
Now i'm trying write a new class which use to find the button and check if the button was click one more time?
So can i do this or someone has any solution for this task?
question from:
https://stackoverflow.com/questions/65626402/how-to-check-a-button-was-clicked-without-overried-onclick-method 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…