Commit 89368a23 authored by Tanmim Hanifa's avatar Tanmim Hanifa

Gender

Added gender option for registration
parent 43c964ed
......@@ -7,6 +7,7 @@ import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
......@@ -28,6 +29,8 @@ public class RegisterActivity extends AppCompatActivity {
final EditText etPassword = (EditText) findViewById(R.id.etPassword);
final EditText etEmail = (EditText) findViewById(R.id.etEmail);
final Spinner gSpinner = (Spinner) findViewById(R.id.gSpinner);
final Button btnRegister = (Button) findViewById(R.id.btnRegister);
btnRegister.setOnClickListener(new View.OnClickListener() {
......@@ -39,6 +42,7 @@ public class RegisterActivity extends AppCompatActivity {
final String dob = etDob.getText().toString();
final String email = etEmail.getText().toString();
final String gender = gSpinner.getSelectedItem().toString();
Response.Listener<String> responseListener = new Response.Listener<String>(){
......@@ -65,7 +69,7 @@ public class RegisterActivity extends AppCompatActivity {
}
};
RegisterRequest registerRequest = new RegisterRequest(name, username, dob, email, password, responseListener);
RegisterRequest registerRequest = new RegisterRequest(name, gender, username, dob, email, password, responseListener);
RequestQueue queue = Volley.newRequestQueue(RegisterActivity.this);
queue.add(registerRequest);
......
......@@ -16,7 +16,7 @@ public class RegisterRequest extends StringRequest {
private Map<String, String> params;
public RegisterRequest(String name, String username, String dob, String email, String password, Response.Listener<String> listener){
public RegisterRequest(String name, String gender, String username, String dob, String email, String password, Response.Listener<String> listener){
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("name", name);
......@@ -24,6 +24,7 @@ public class RegisterRequest extends StringRequest {
params.put("password", password);
params.put("dob", dob + "");
params.put("email", email);
params.put("gender", gender);
}
@Override
......
......@@ -32,6 +32,18 @@
android:layout_below="@id/etName"
android:layout_alignStart="@id/etName" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginBottom="10dp"
android:layout_alignStart="@+id/etDob"
android:entries="@array/gender"
android:id="@+id/gSpinner"
android:layout_below="@+id/etDob"
android:layout_alignEnd="@+id/etDob">
</Spinner>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -41,7 +53,7 @@
android:hint="Email Address"
android:layout_marginBottom="10dp"
android:layout_alignStart="@id/etDob"
android:layout_below="@id/etDob"/>
android:layout_below="@id/gSpinner"/>
<EditText
android:layout_width="wrap_content"
......
......@@ -6,4 +6,9 @@
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="action_settings">Settings</string>
<string-array name="gender">
<item>Male</item>
<item>Female</item>
</string-array>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment