title: How to fix "com.android.Volley.TimeoutError" in android while trying to perform a registration activity
body: <p>I am using wamp server as my localhost and I have an app that I want to capture user's particulars during registration. Notwithstanding, the app runs fine on my mobile phone but when I fill the the editText and click my registration button I get this error "Registration Errorcom.android.Volley.TimeoutError". </p>
  
  <p>I have tried checking for any errors in the logcat but found none. Anyone who is good at Android (Java) programing could kindly help me resolve this. Here is my layout code and the java class code. Thanks in advance</p>
  
  <pre><code>My Layout Code
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:paddingLeft="30dp"
  android:paddingRight="30dp"
  android:paddingTop="60dp"
  android:background="@color/colorPrimaryDark2"
  tools:context=".RegisterActivity"&gt;
  
  &lt;ImageView
      android:id="@+id/imageView"
      android:layout_width="match_parent"
      android:layout_height="150dp"
      android:contentDescription="@string/todo"
      android:src="@drawable/ic_lock_outline_white" /&gt;
  
  &lt;com.google.android.material.textfield.TextInputLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;EditText
          android:id="@+id/name"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:autofillHints=""
          android:hint="@string/name"
          android:inputType="textPersonName"
          android:textColor="@color/ColorText"
          tools:targetApi="o" /&gt;
  
  &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;com.google.android.material.textfield.TextInputLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;EditText
          android:id="@+id/constituency"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:autofillHints=""
          android:hint="@string/county"
          android:inputType="textPersonName"
          android:textColor="@color/ColorText"
          tools:targetApi="o" /&gt;
  
  &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;com.google.android.material.textfield.TextInputLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;EditText
          android:id="@+id/email"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:autofillHints=""
          android:hint="@string/email"
          android:inputType="textEmailAddress"
          android:textColor="@color/ColorText"
          tools:targetApi="o" /&gt;
  
  &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;com.google.android.material.textfield.TextInputLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:passwordToggleEnabled="true"&gt;
  
      &lt;EditText
          android:id="@+id/password"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:autofillHints=""
          android:hint="@string/password"
          android:inputType="textPassword"
          android:textColor="@color/C2olorText"
          tools:targetApi="o" /&gt;
  
  &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;com.google.android.material.textfield.TextInputLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:passwordToggleEnabled="true"&gt;
  
      &lt;EditText
          android:id="@+id/c_password"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:autofillHints=""
          android:hint="@string/confirm_password"
          android:inputType="textPassword"
          android:textColor="@color/ColorText"
          tools:targetApi="o" /&gt;
  enter code here
  &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;ProgressBar
      android:id="@+id/loading"
      android:layout_marginTop="30dp"
      android:visibility="gone"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/&gt;
  
  &lt;Button
      android:id="@+id/btn_regist"
      android:layout_width="match_parent"
      android:layout_height="55dp"
      android:layout_marginTop="30dp"
      android:text="@string/register"
      android:backgroundTint="@color/colorPrimary"
      android:textColor="@android:color/white"
      tools:targetApi="lollipop" /&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>The Java class code
  
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ProgressBar;
  import android.widget.Toast;
  
  import androidx.appcompat.app.AppCompatActivity;
  
  import com.android.volley.AuthFailureError;
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.StringRequest;
  import com.android.volley.toolbox.Volley;
  
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.HashMap;
  import java.util.Map;
  
  public class RegisterActivity extends AppCompatActivity {
  private EditText name, constituency, email, password, c_password;
  private Button btn_regist;
  private ProgressBar loading;
  private static String URL_REGIST = "http://192.168.0.115/kpp/register.php";
  
  @Override
  protected void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_register);
  
      loading = findViewById(R.id.loading);
      name = findViewById(R.id.name);
      constituency = findViewById(R.id.constituency);
      email = findViewById(R.id.email);
      password = findViewById(R.id.password);
      c_password = findViewById(R.id.c_password);
      btn_regist = findViewById(R.id.btn_regist);
  
      btn_regist.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Regist();
          }
      });
  
  }
  private void Regist(){
      loading.setVisibility(View.VISIBLE);
      btn_regist.setVisibility(View.GONE);
  
      final String name = this.name.getText().toString().trim();
      final String constituency =     this.constituency.getText().toString().trim();
      final String email = this.email.getText().toString().trim();
      final String password = this.password.getText().toString().trim();
  
      StringRequest stringRequest = new StringRequest(Request.Method.POST, URL_REGIST, new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
          try{
              JSONObject jsonObject = new JSONObject(response);
              String success = jsonObject.getString("success");
  
              if(success.equals("1")){
                  Toast.makeText(RegisterActivity.this, "Registration Successful!", Toast.LENGTH_SHORT).show();
              }
          } catch (JSONException e) {
              e.printStackTrace();
              Toast.makeText(RegisterActivity.this, "Registration Error" + e.toString(), Toast.LENGTH_SHORT).show();
              loading.setVisibility(View.GONE);
              btn_regist.setVisibility(View.VISIBLE);
          }
          }
      },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Toast.makeText(RegisterActivity.this, "Registration Error" + error.toString(), Toast.LENGTH_SHORT).show();
                      loading.setVisibility(View.GONE);
                      btn_regist.setVisibility(View.VISIBLE);
                  }
              })
      {
          @Override
          protected Map&lt;String, String&gt; getParams() throws    AuthFailureError {
              Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
              params.put("name",name);
              params.put("constituency",constituency);
              params.put("email",email);
              params.put("password",password);
              return params;
          }
      };
  
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      requestQueue.add(stringRequest);
  }`enter code here`
  </code></pre>
  
  <p>}</p>
  
  <p>I expect upon successful registration it toast to notify the user "Registration Successful!"...</p>