How to make a landing button does not fill in username and password when pressed no way
Reply:
Input box is edittext right? Assumption is mUserNameEditText. Buttons assumption is mLoginButton
if (mUserNameEditText.getEditableText (). toString (). equals ("")) {
mLoginButton.setEnable (false);
}
Reply:
btn.setOnClickListener (new OnClickListener {
public void onClick (View v) {
if (/ / if user name password is blank) {
return;
} Else {
/ / Login
}
}
});
Reply:
You can use the edittext of addTextChangedListener event listener
editText.addTextChangedListener (new TextWatcher () {
public void afterTextChanged (Editable s) {
/ / TODO Auto-generated method stub
/ / S: after changing all characters
Toast.makeText (getApplicationContext (), "change:" + s, Toast.LENGTH_SHORT) show ();
.}
public void beforeTextChanged (CharSequence s, int start, int count,
int after) {
/ / TODO Auto-generated method stub
/ / S: all the characters before the change; start: the position of the character begins; count: The total number of bytes before the change; after: after changing the number of bytes
Toast.makeText (getApplicationContext (), "before the change:" + s + ";" + start + ";" + count + ";" + after, Toast.LENGTH_SHORT). Show ();
}
public void onTextChanged (CharSequence s, int start, int before,
int count) {
/ / TODO Auto-generated method stub
/ / S: all the characters after the change; start: character starting position; before: the total number of bytes before the change; count: the number of bytes
after changeToast.makeText. (GetApplicationContext (), "after the change:" + s + ";" + start + ";" + before + ";" + count, Toast.LENGTH_SHORT) show ();
}
});
No comments:
Post a Comment