Java 一个改型为2的应用程序在向Mysql发布数据时崩溃

Java 一个改型为2的应用程序在向Mysql发布数据时崩溃,java,android,retrofit2,Java,Android,Retrofit2,我正在开发一个android应用程序,它需要使用php将数据发布到mysqldb。现在我正在尝试注册一个应用程序的用户。我已经创建了2个php类Connection和insertUser。有了邮递员,我可以成功地将数据插入数据库。但是当我试着用物理电话时,它崩溃了。我的代码构建没有错误,直到我按下SignUp按钮,它才能正常工作。我看不出我在哪里犯了错误。请帮忙 我已经添加了依赖项 compile 'com.squareup.retrofit2:retrofit:2.3.0' c

我正在开发一个android应用程序,它需要使用
php
将数据发布到
mysql
db。现在我正在尝试注册一个应用程序的用户。我已经创建了2个
php
ConnectioninsertUser。有了邮递员,我可以成功地将数据插入数据库。但是当我试着用物理电话时,它崩溃了。我的代码构建没有错误,直到我按下
SignUp
按钮,它才能正常工作。我看不出我在哪里犯了错误。请帮忙

我已经添加了依赖项

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp:okhttp:2.0.0'
Connection.php用于连接我的本地主机XAMPP Phpmyadmin

<?php

    class Connection{
        function getConnection(){
            $host       = "localhost";
            $username   = "root";
            $password   = "root";
            $dbname     = "activityplanner_db";
            try{
                $conn    = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
                $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                return $conn;
            }catch (PDOException $e){
                echo "ERROR CONNECTIONF : " . $e->getMessage();
            }
        }
    }

    ?>
我的
URLs.java
Api客户端,用于
改造客户端

public class URLs {

    public static final String URL = "http://192.168.43.172/activityplanner_php/"; 
//当我将电脑连接到手机的热点时,这将是我的ipv4 ip。 公共静态改装=空

    public static Retrofit getClient(){
        if (retrofit==null){
            OkHttpClient client = new OkHttpClient.Builder()
                    .addInterceptor(new LoggingInterceptors())
                    .build();
            retrofit = new Retrofit.Builder()
                    .baseUrl(URL)
                    .client(client)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
        }
        return retrofit;
    }

}
还有我的RegisterApi接口

public interface RegisterAPI {

    @FormUrlEncoded
    @POST("/activityplanner_php/insertUser.php")
    Call<User> insertUser(@Field("LastName") String LastName, @Field("FirstName") String FirstName,
                          @Field("User_Email") String User_Email, @Field("MobilePhone") long MobilePhone,
                          @Field("SSN") String SSN, @Field("User_Password") String User_Password,
                          @Field("User_City") String User_City, @Field("User_Job") String User_Job,
                          @Field("User_BirthDate") Date User_BirthDate, @Field("Gender") String Gender);
}
还有我的注册活动

public class SignUpActivity extends AppCompatActivity {

    EditText etLastName, etFirstName, etEmail, etMobilePhone, etSsn, etPassword, etCity, etJob, etBirthDate;
    RadioGroup rgGender;
    Spinner spUserType;
    ProgressDialog progressDialog;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);

        Button btnSignUp = (Button) findViewById(R.id.bSignUp);
        etBirthDate = (EditText) findViewById(R.id.etBirthDate);
        etLastName = (EditText) findViewById(R.id.etLastName);
        etFirstName = (EditText) findViewById(R.id.etName);
        etEmail = (EditText) findViewById(R.id.etEmail);
        etMobilePhone = (EditText) findViewById(R.id.etPhone);
        etSsn = (EditText) findViewById(R.id.etSSN);
        etPassword = (EditText) findViewById(R.id.etPassword);
        etCity = (EditText) findViewById(R.id.etCity);
        etJob = (EditText) findViewById(R.id.etJob);
        rgGender = (RadioGroup) findViewById(R.id.rgGender);
        spUserType = (Spinner) findViewById(R.id.spUserRole);

        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                insertUser();
            }
        });


    }
    /*public void GoToLoginActivity(View v) {
        insertUser();
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
    }*/


    private void insertUser(){
        progressDialog.show();

        String firstName = etFirstName.getText().toString();
        String lastName = etLastName.getText().toString();
        String u_Email = etEmail.getText().toString();

        int radioButtonId = rgGender.getCheckedRadioButtonId();
        View radioButton = rgGender.findViewById(radioButtonId);
        int idx = rgGender.indexOfChild(radioButton);
        RadioButton rbGender = (RadioButton)rgGender.getChildAt(idx);

        String gender = rbGender.getText().toString();
        Long mobilePhone =Long.parseLong(etMobilePhone.getText().toString());
        String ssn = etSsn.getText().toString();
        String u_City = etCity.getText().toString();
        Date birthDate =Date.valueOf(etBirthDate.getText().toString());
        String u_Job = etJob.getText().toString();
        String password = etPassword.getText().toString();

        insertData(firstName,lastName,u_Email,gender,mobilePhone,ssn,u_City,birthDate,u_Job,password);
    }
        private void insertData(String firstName, String lastName, String u_Email, String gender,
                Long mobilePhone, String ssn, String u_City, Date birthDate, String u_Job, String password){

            RegisterAPI registerAPI = URLs.getClient().create(RegisterAPI.class);
            Call<User> call = registerAPI.insertUser(firstName, lastName, u_Email, mobilePhone, ssn, password,
                    u_City, u_Job, birthDate, gender);
            call.enqueue(new Callback<User>() {
                @Override
                public void onResponse(Call<User> call, Response<User> response) {
                    User user =response.body();

                    if(user.getStatus()==1){
                        Toast.makeText(SignUpActivity.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
                        progressDialog.dismiss();
                    }else{
                        Toast.makeText(SignUpActivity.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
                        progressDialog.dismiss();
                    }
                }

                @Override
                public void onFailure(Call<User> call, Throwable t) {
                    Toast.makeText(SignUpActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
                    progressDialog.dismiss();
                }
            });
        }

}
公共类注册活动扩展了AppCompatActivity{
EditText etLastName、etFirstName、etMail、etMobilePhone、etSsn、etPassword、etCity、etJob、etBirthDate;
放射组性别;
纺纱机纺纱机;
进行对话进行对话;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u注册);
按钮btnSignUp=(按钮)findViewById(R.id.bSignUp);
etBirthDate=(EditText)findViewById(R.id.etBirthDate);
etLastName=(EditText)findViewById(R.id.etLastName);
etFirstName=(EditText)findViewById(R.id.etName);
etEmail=(EditText)findViewById(R.id.etEmail);
etMobilePhone=(EditText)findViewById(R.id.etPhone);
etSsn=(EditText)findViewById(R.id.etSsn);
etPassword=(EditText)findViewById(R.id.etPassword);
etCity=(EditText)findViewById(R.id.etCity);
etJob=(EditText)findViewById(R.id.etJob);
rgGender=(放射组)findViewById(R.id.rgGender);
spUserType=(微调器)findViewById(R.id.spUserRole);
btnSignUp.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图){
插入器();
}
});
}
/*公共活动(视图五){
插入器();
Intent Intent=新Intent(这是LoginActivity.class);
星触觉(意向);
}*/
私有void insertUser(){
progressDialog.show();
String firstName=etFirstName.getText().toString();
字符串lastName=etLastName.getText().toString();
字符串u_Email=etEmail.getText().toString();
int radioButtonId=rgGender.getCheckedRadioButtonId();
查看radioButton=rgGender.findViewById(radioButtonId);
int idx=rgGender.indexOfChild(单选按钮);
RadioButton rbGender=(RadioButton)rgGender.getChildAt(idx);
字符串gender=rbGender.getText().toString();
Long mobilePhone=Long.parseLong(etMobilePhone.getText().toString());
字符串ssn=etSsn.getText().toString();
字符串u_City=etCity.getText().toString();
Date birthDate=Date.valueOf(etBirthDate.getText().toString());
字符串u_Job=etJob.getText().toString();
字符串password=etPassword.getText().toString();
插入数据(名字、姓氏、u_电子邮件、性别、手机、ssn、u_城市、出生日期、u_工作、密码);
}
私有void insertData(字符串firstName、字符串lastName、字符串u_电子邮件、字符串性别、,
长手机、字符串ssn、字符串u_城市、日期生日、字符串u_工作、字符串密码){
RegisterAPI RegisterAPI=url.getClient().create(RegisterAPI.class);
Call Call=registerAPI.insertUser(名字、姓氏、电子邮件、手机、ssn、密码、,
城市、工作、出生日期、性别);
call.enqueue(新回调(){
@凌驾
公共void onResponse(调用、响应){
User=response.body();
if(user.getStatus()==1){
Toast.makeText(SignUpActivity.this,response.body().getMessage(),Toast.LENGTH_SHORT.show();
progressDialog.disclose();
}否则{
Toast.makeText(SignUpActivity.this,response.body().getMessage(),Toast.LENGTH_SHORT.show();
progressDialog.disclose();
}
}
@凌驾
失败时公共无效(调用调用,可丢弃的t){
Toast.makeText(SignUpActivity.this,t.getMessage(),Toast.LENGTH_SHORT).show();
progressDialog.disclose();
}
});
}
}
My activity\u sign\u.xml布局

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:background="@color/OpeningBackground"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:background="@color/toolbar"
        android:minHeight="?attr/actionBarSize"
        android:theme="@android:style/Widget"
        tools:layout_editor_absoluteY="1dp" />

    <ScrollView
        style="@android:style/Widget.DeviceDefault.Light.ScrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="52dp"
        android:clipToPadding="true"
        android:fillViewport="true"
        android:scrollbarStyle="insideOverlay"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="200dp">

            <EditText
                android:id="@+id/etBirthDate"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:layout_marginStart="8dp"
                android:hint="@string/birthDate"
                android:inputType="date"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etJob" />

            <EditText
                android:id="@+id/etPassword"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_marginStart="8dp"
                android:layout_height="45dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/password"
                android:inputType="numberPassword"
                android:textAppearance="@android:style/Widget.Material.Light.EditText"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                android:textSize="16sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etSSN" />

            <EditText
                android:id="@+id/etPhone"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_marginStart="8dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/phone"
                android:inputType="phone"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etEmail" />

            <EditText
                android:id="@+id/etName"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="179dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="200dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/Name"
                android:inputType="textPersonName"
                android:singleLine="true"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <EditText
                android:id="@+id/etLastName"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="182dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:layout_marginStart="8dp"
                android:hint="@string/lName"
                android:inputType="textPersonName"
                android:singleLine="true"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <EditText
                android:id="@+id/etEmail"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:ems="10"
                android:hint="@string/email"
                android:inputType="textEmailAddress"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etLastName" />

            <EditText
                android:id="@+id/etSSN"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/ssn"
                android:inputType="number"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etPhone" />

            <EditText
                android:id="@+id/etCity"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/city"
                android:inputType="textPersonName"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etPassword" />

            <EditText
                android:id="@+id/etJob"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/Job"
                android:inputType="textPersonName"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etCity" />

            <Spinner
                android:id="@+id/spUserRole"
                style="@android:style/Widget.Material.Light.TextView.SpinnerItem"
                android:layout_width="364dp"
                android:layout_height="51dp"
                android:layout_marginBottom="175dp"
                android:layout_marginStart="8dp"
                android:entries="@array/user_role"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/tUser_Role_Hint"
                app:layout_constraintVertical_bias="0.0" />

            <TextView
                android:id="@+id/tUser_Role_Hint"
                android:layout_width="364dp"
                android:layout_height="41dp"
                android:layout_marginTop="16dp"
                android:layout_marginStart="8dp"
                android:text="@string/user_role_hint"
                android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large"
                android:textColor="#ffffff"
                android:textSize="18sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etBirthDate" />

            <Button
                android:id="@+id/bSignUp"
                style="@android:style/Widget.Material.Light.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="48dp"
                android:layout_marginEnd="32dp"
                android:backgroundTint="@color/OpeningBackground"
                android:text="@string/btnSignUp"
                android:textColor="@android:color/background_light"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent" />

            <TextView
                android:id="@+id/textView"
                android:layout_width="92dp"
                android:layout_height="27dp"
                android:layout_marginStart="24dp"
                android:layout_marginTop="32dp"
                android:text="@string/gender"
                android:textColor="@color/buttoncolor"
                android:textSize="20sp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/spUserRole" />

            <RadioGroup
                android:id="@+id/rgGender"
                android:layout_width="177dp"
                android:layout_height="91dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="12dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/textView">

                <RadioButton
                    android:id="@+id/rbMan"
                    style="@android:style/Widget.DeviceDefault.Light.CompoundButton.RadioButton"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:buttonTint="@color/buttoncolor"
                    android:text="Erkek"
                    android:textColor="#ffffff"
                    tools:layout_editor_absoluteX="16dp"
                    tools:layout_editor_absoluteY="676dp" />

                <RadioButton
                    android:id="@+id/rbWoman"
                    style="@android:style/Widget.DeviceDefault.Light.CompoundButton.RadioButton"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:buttonTint="@color/buttoncolor"
                    android:text="Kadın"
                    android:textColor="#ffffff"
                    tools:layout_editor_absoluteX="130dp"
                    tools:layout_editor_absoluteY="676dp" />
            </RadioGroup>

        </android.support.constraint.ConstraintLayout>
    </ScrollView>

</android.support.design.widget.CoordinatorLayout>

我看不到您在这里初始化进度对话框。我猜这就是在调用show()之前没有初始化进度对话框的错误。


你是不是忘了发日志了。我已经搜索了几个小时的代码,就这么简单。谢谢它成功了
public class User {

    @SerializedName("success")
    private int status;
    @SerializedName("message")
    private String message;

    public User(int status, String message) {
        this.status = status;
        this.message = message;
    }

    public User() {
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }    
}
public class SignUpActivity extends AppCompatActivity {

    EditText etLastName, etFirstName, etEmail, etMobilePhone, etSsn, etPassword, etCity, etJob, etBirthDate;
    RadioGroup rgGender;
    Spinner spUserType;
    ProgressDialog progressDialog;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);

        Button btnSignUp = (Button) findViewById(R.id.bSignUp);
        etBirthDate = (EditText) findViewById(R.id.etBirthDate);
        etLastName = (EditText) findViewById(R.id.etLastName);
        etFirstName = (EditText) findViewById(R.id.etName);
        etEmail = (EditText) findViewById(R.id.etEmail);
        etMobilePhone = (EditText) findViewById(R.id.etPhone);
        etSsn = (EditText) findViewById(R.id.etSSN);
        etPassword = (EditText) findViewById(R.id.etPassword);
        etCity = (EditText) findViewById(R.id.etCity);
        etJob = (EditText) findViewById(R.id.etJob);
        rgGender = (RadioGroup) findViewById(R.id.rgGender);
        spUserType = (Spinner) findViewById(R.id.spUserRole);

        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                insertUser();
            }
        });


    }
    /*public void GoToLoginActivity(View v) {
        insertUser();
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
    }*/


    private void insertUser(){
        progressDialog.show();

        String firstName = etFirstName.getText().toString();
        String lastName = etLastName.getText().toString();
        String u_Email = etEmail.getText().toString();

        int radioButtonId = rgGender.getCheckedRadioButtonId();
        View radioButton = rgGender.findViewById(radioButtonId);
        int idx = rgGender.indexOfChild(radioButton);
        RadioButton rbGender = (RadioButton)rgGender.getChildAt(idx);

        String gender = rbGender.getText().toString();
        Long mobilePhone =Long.parseLong(etMobilePhone.getText().toString());
        String ssn = etSsn.getText().toString();
        String u_City = etCity.getText().toString();
        Date birthDate =Date.valueOf(etBirthDate.getText().toString());
        String u_Job = etJob.getText().toString();
        String password = etPassword.getText().toString();

        insertData(firstName,lastName,u_Email,gender,mobilePhone,ssn,u_City,birthDate,u_Job,password);
    }
        private void insertData(String firstName, String lastName, String u_Email, String gender,
                Long mobilePhone, String ssn, String u_City, Date birthDate, String u_Job, String password){

            RegisterAPI registerAPI = URLs.getClient().create(RegisterAPI.class);
            Call<User> call = registerAPI.insertUser(firstName, lastName, u_Email, mobilePhone, ssn, password,
                    u_City, u_Job, birthDate, gender);
            call.enqueue(new Callback<User>() {
                @Override
                public void onResponse(Call<User> call, Response<User> response) {
                    User user =response.body();

                    if(user.getStatus()==1){
                        Toast.makeText(SignUpActivity.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
                        progressDialog.dismiss();
                    }else{
                        Toast.makeText(SignUpActivity.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
                        progressDialog.dismiss();
                    }
                }

                @Override
                public void onFailure(Call<User> call, Throwable t) {
                    Toast.makeText(SignUpActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
                    progressDialog.dismiss();
                }
            });
        }

}
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:background="@color/OpeningBackground"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:background="@color/toolbar"
        android:minHeight="?attr/actionBarSize"
        android:theme="@android:style/Widget"
        tools:layout_editor_absoluteY="1dp" />

    <ScrollView
        style="@android:style/Widget.DeviceDefault.Light.ScrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="52dp"
        android:clipToPadding="true"
        android:fillViewport="true"
        android:scrollbarStyle="insideOverlay"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="200dp">

            <EditText
                android:id="@+id/etBirthDate"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:layout_marginStart="8dp"
                android:hint="@string/birthDate"
                android:inputType="date"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etJob" />

            <EditText
                android:id="@+id/etPassword"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_marginStart="8dp"
                android:layout_height="45dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/password"
                android:inputType="numberPassword"
                android:textAppearance="@android:style/Widget.Material.Light.EditText"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                android:textSize="16sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etSSN" />

            <EditText
                android:id="@+id/etPhone"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_marginStart="8dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/phone"
                android:inputType="phone"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etEmail" />

            <EditText
                android:id="@+id/etName"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="179dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="200dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/Name"
                android:inputType="textPersonName"
                android:singleLine="true"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <EditText
                android:id="@+id/etLastName"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="182dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:layout_marginStart="8dp"
                android:hint="@string/lName"
                android:inputType="textPersonName"
                android:singleLine="true"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <EditText
                android:id="@+id/etEmail"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:ems="10"
                android:hint="@string/email"
                android:inputType="textEmailAddress"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etLastName" />

            <EditText
                android:id="@+id/etSSN"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/ssn"
                android:inputType="number"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etPhone" />

            <EditText
                android:id="@+id/etCity"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/city"
                android:inputType="textPersonName"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etPassword" />

            <EditText
                android:id="@+id/etJob"
                style="@android:style/Widget.Material.Light.EditText"
                android:layout_width="364dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:ems="10"
                android:hint="@string/Job"
                android:inputType="textPersonName"
                android:textColor="#ffffff"
                android:textColorHint="#ffffff"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etCity" />

            <Spinner
                android:id="@+id/spUserRole"
                style="@android:style/Widget.Material.Light.TextView.SpinnerItem"
                android:layout_width="364dp"
                android:layout_height="51dp"
                android:layout_marginBottom="175dp"
                android:layout_marginStart="8dp"
                android:entries="@array/user_role"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/tUser_Role_Hint"
                app:layout_constraintVertical_bias="0.0" />

            <TextView
                android:id="@+id/tUser_Role_Hint"
                android:layout_width="364dp"
                android:layout_height="41dp"
                android:layout_marginTop="16dp"
                android:layout_marginStart="8dp"
                android:text="@string/user_role_hint"
                android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large"
                android:textColor="#ffffff"
                android:textSize="18sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/etBirthDate" />

            <Button
                android:id="@+id/bSignUp"
                style="@android:style/Widget.Material.Light.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="48dp"
                android:layout_marginEnd="32dp"
                android:backgroundTint="@color/OpeningBackground"
                android:text="@string/btnSignUp"
                android:textColor="@android:color/background_light"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent" />

            <TextView
                android:id="@+id/textView"
                android:layout_width="92dp"
                android:layout_height="27dp"
                android:layout_marginStart="24dp"
                android:layout_marginTop="32dp"
                android:text="@string/gender"
                android:textColor="@color/buttoncolor"
                android:textSize="20sp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/spUserRole" />

            <RadioGroup
                android:id="@+id/rgGender"
                android:layout_width="177dp"
                android:layout_height="91dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="12dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/textView">

                <RadioButton
                    android:id="@+id/rbMan"
                    style="@android:style/Widget.DeviceDefault.Light.CompoundButton.RadioButton"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:buttonTint="@color/buttoncolor"
                    android:text="Erkek"
                    android:textColor="#ffffff"
                    tools:layout_editor_absoluteX="16dp"
                    tools:layout_editor_absoluteY="676dp" />

                <RadioButton
                    android:id="@+id/rbWoman"
                    style="@android:style/Widget.DeviceDefault.Light.CompoundButton.RadioButton"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:buttonTint="@color/buttoncolor"
                    android:text="Kadın"
                    android:textColor="#ffffff"
                    tools:layout_editor_absoluteX="130dp"
                    tools:layout_editor_absoluteY="676dp" />
            </RadioGroup>

        </android.support.constraint.ConstraintLayout>
    </ScrollView>

</android.support.design.widget.CoordinatorLayout>
ProgressDialog progressDialog;

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);
        progressDialog = new ProgressDialog(this);
        ...............

}