android – email address is badly formatted firebase

android – email address is badly formatted firebase

Questions : android – email address is badly formatted firebase

6339

hello I’m making a login in my project and in4codes_firebase when I try to input the data it says email in4codes_firebase address is badly formatted

Codes

public class MainActivity extends AppCompatActivity { private EditText email; private EditText Password; private ImageButton BackMenu; private TextView SignIn; private Button login; ProgressBar progressBar; private FirebaseAuth auth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progressBar = findViewById(R.id.progressBar); progressBar.setVisibility(View.GONE); email = (EditText)findViewById(R.id.log_email); Password = (EditText)findViewById(R.id.password); BackMenu = (ImageButton)findViewById(R.id.returnMenu); SignIn = (TextView) findViewById(R.id.reg_SignIn); login = (Button)findViewById(R.id.btn_Login); auth = FirebaseAuth.getInstance(); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loginUser(); } }); SignIn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { registrationForm(); progressBar.setVisibility(View.VISIBLE); } }); BackMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openShopMenu(); progressBar.setVisibility(View.VISIBLE); } }); } private void loginUser() { String userEmail = email.getText().toString().trim(); String userPass = Password.getText().toString().trim(); progressBar.setVisibility(View.VISIBLE); if (TextUtils.isEmpty(userEmail)){ Toast.makeText(this, "Email is empty", Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.GONE); return; } if (TextUtils.isEmpty(userPass)){ Toast.makeText(this, "Password is empty", Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.GONE); return; } if (userPass.length() < 5){ Toast.makeText(this, "Password must be 5 characters or more", Toast.LENGTH_SHORT).show(); } auth.signInWithEmailAndPassword(userPass,userEmail) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()){ Toast.makeText(MainActivity.this, "Login is Successful", Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.GONE); } else { Toast.makeText(MainActivity.this, "Error"+task.getException(), Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.GONE); } } }); } public void openShopMenu() { Intent intent = new Intent(MainActivity.this, ShopMenu.class); startActivity(intent); progressBar.setVisibility(View.GONE); } public void registrationForm(){ Intent intent = new Intent(MainActivity.this,Registration.class); startActivity(intent); progressBar.setVisibility(View.GONE); } 

}

Problem

the input is:

Email : [email protected]

Password : 12345678

The user fails to login and the message in4codes_firebase below pops out

The email address is badly formatted

and I don’t think there’s a problem in my in4codes_firebase .xml file

android:inputType=”textEmailAddress”

Total Answers 0