private void RegisterDriver(String email, String password)
{
loadingBar.setTitle("Решистрация водителя");
loadingBar.setMessage("Пожалуйста дождитесь загрузки");
loadingBar.show();
mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful())
{
Toast.makeText(DriverRegLogActivity.this, "Регистрация прошла успешно!", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
else
{
Toast.makeText(DriverRegLogActivity.this, "Ошибка", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
}
Это передача
Сам код
package taxicity.app;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
public class DriverRegLogActivity extends AppCompatActivity {
TextView statusdriver,accountcreate;
Button buttonReg,buttonLog;
EditText driverEmail,driverPassword;
ImageView arrowdriver;
FirebaseAuth mAuth;
ProgressDialog loadingBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_driver_reg_log);
statusdriver=(TextView) findViewById(R.id.statusdriver);
buttonLog=(Button) findViewById(R.id.buttonLog);
buttonReg=(Button) findViewById(R.id.buttonReg);
driverEmail=(EditText) findViewById(R.id.driverEmail);
driverPassword=(EditText)findViewById(R.id.driverPassword);
accountcreate=(TextView) findViewById(R.id.accountcreate);
arrowdriver=(ImageView) findViewById(R.id.arrowdriver);
mAuth=FirebaseAuth.getInstance();
loadingBar=new ProgressDialog(this);
buttonReg.setVisibility(View.INVISIBLE);
buttonReg.setEnabled(false);
arrowdriver.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent arrowIntent=new Intent(DriverRegLogActivity.this,WellActivity.class);
startActivity(arrowIntent);
}
});
accountcreate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
buttonLog.setVisibility(View.INVISIBLE);
accountcreate.setVisibility(View.INVISIBLE);
buttonReg.setVisibility(View.VISIBLE);
buttonReg.setEnabled(true);
statusdriver.setText("Регистрация для водителей");
}
});
buttonReg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = driverEmail.getText().toString();
String password=driverPassword.getText().toString();
RegisterDriver(email,password);
}
});
}
Почему не работает?