Is there an issue with my code? when I include this snippet the app fails to launch:
` final TextInputLayout passwordTextInput = view.findViewById(R.id.password_text_input);
final TextInputLayout passwordEditText = view.findViewById(R.id.password_edit_text);
MaterialButton nextButton = view.findViewById(R.id.next_button);
// Snippet from "Navigate to the next Fragment" section goes here.
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isPasswordValid((Editable) passwordEditText.getEditText()))
{
passwordTextInput.setError(getString(R.string.shr_error_password));
}
else
{
passwordTextInput.setError(null);//clear the error
((NavigationHost)getActivity()).navigateTo(new ProductGridFragment(),false);// false removes previous screen from back stack
}
}
});
// Clear the error once more than 8 characters are typed
passwordEditText.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (isPasswordValid((Editable) passwordEditText.getEditText()))
{
passwordTextInput.setError(null);// clear the error
}
return false;
}
});`
Is there an issue with my code? when I include this snippet the app fails to launch:
` final TextInputLayout passwordTextInput = view.findViewById(R.id.password_text_input); final TextInputLayout passwordEditText = view.findViewById(R.id.password_edit_text); MaterialButton nextButton = view.findViewById(R.id.next_button);
Help?????