title: volley timeout error...Data inserting two times
body: <p>I m getting <code>volley timeout error</code> every time i try  to insert data..Despite of the error, the data is inserted correctly but its inserting two times every time i press the <code>button</code>.
  I need to remove the <code>error</code> and insert data only once. Also it takes too much time after clicking <code>button</code> to display error.</p>
  
  <pre><code>package com.example.sumit.myapplication;
  import android.content.Context;
  import android.content.pm.ActivityInfo;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.support.v7.widget.CardView;
  import android.text.TextUtils;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.WindowManager;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  
  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 com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.database.MutableData;
  import com.google.firebase.database.Transaction;
  import com.google.firebase.database.ValueEventListener;
  
  import java.sql.Connection;
  import java.util.HashMap;
  import java.util.Map;
  
  /**
  * Created by Sumit on 20-02-2018.
  */
  
  public class register extends Fragment{
  RequestQueue requestQueue;
  public View onCreateView(LayoutInflater inflater, ViewGroup container,                     Bundle savedInstanceState){
      getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      View v = inflater.inflate(R.layout.login,container,false);
      return v;
  }
  public void onCreate(Bundle savedInstancesState)
  {
      super.onCreate(savedInstancesState);
      TextView t = (TextView) ((MainActivity) getActivity()).findViewById(R.id.textView3);
      t.setText("Register");
  
  }
  
  
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  
  
      final View vt = super.getView();
      final CardView b=(CardView)vt.findViewById(R.id.cardView);
      final TextView txt = (TextView)vt.findViewById(R.id.uid);
      final EditText txt1 = (EditText) vt.findViewById(R.id.editText);
      final EditText txt2 = (EditText) vt.findViewById(R.id.editText2);
      final EditText txt3 = (EditText) vt.findViewById(R.id.editText3);
      final EditText txt4 = (EditText) vt.findViewById(R.id.editText4);
      final Spinner hostel1=(Spinner) vt.findViewById(R.id.spinner1);
      final Spinner branch1=(Spinner) vt.findViewById(R.id.spinner2);
      final String HttpUrl = "https://testzineapp.000webhostapp.com/insert_record.php";
  
  
  
  
      b.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View vt) {
  
              final String id=txt1.getText().toString().trim();
              final String name=txt2.getText().toString().trim();
              final String number=txt3.getText().toString().trim();
              final String email=txt4.getText().toString().trim();
              final String hostel=hostel1.getSelectedItem().toString().trim();
              final String branch=branch1.getSelectedItem().toString().trim();
  
              StringRequest stringRequest = new StringRequest(Request.Method.POST, HttpUrl,
                      new Response.Listener&lt;String&gt;() {
                          @Override
                          public void onResponse(String ServerResponse) {
  
                              // Showing response message coming from server.
                              Toast.makeText(getContext(), ServerResponse, Toast.LENGTH_LONG).show();
                          }
                      },
                      new Response.ErrorListener() {
                          @Override
                          public void onErrorResponse(VolleyError volleyError) {
  
                              // Showing error message if something goes wrong.
                              Toast.makeText(getContext(), volleyError.toString(), Toast.LENGTH_LONG).show();
                          }
                      }) {
                  @Override
                  protected Map&lt;String, String&gt; getParams() {
  
                      // Creating Map String Params.
                      Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
  
                      // Adding All values to Params.
                      params.put("College_ID", id);
                      params.put("Name", name);
                      params.put("Mobile_Number", number);
                      params.put("Email_ID", email);
                      params.put("Hosteller", hostel);
                      params.put("Branch", branch);
  
                      return params;
                  }
  
              };
  
              // Creating RequestQueue.
              RequestQueue requestQueue = Volley.newRequestQueue(getContext());
  
              // Adding the StringRequest object into requestQueue.
              requestQueue.add(stringRequest);
              txt1.setText("");
              txt2.setText("");
              txt3.setText("");
              txt4.setText("");
  
  
  };
      });
      super.onViewCreated(view, savedInstanceState);
  }
  }
  </code></pre>