I have a submit button where I need to set the visibility of the button based on if a edittext field is empty or not.
I have below snippet in the onCreate method of the activity
submitIssue.setVisibility(View.VISIBLE);
if(issueTxt.getText().toString() == ""){
submitIssue.setVisibility(View.INVISIBLE);
}else{
submitIssue.setVisibility(View.VISIBLE);
}
On launching the application the button displays even though the edittext is empty. What is wrong with my approach?