title: Adding Volley in fragment
body: <p>I want to create Signup page.I am adding volley in SignFragment.I am not able to connect Json. I am giving Signup data with or without parameter.  Please help me.
  Here is my code.</p>
  
  <p>SignFragment.java</p>
  
  <pre><code>    public class SignFragment extends Fragment {
  private EditText editTextFname, editTextLname, editTextMnumber, editTextEmail, editTextPass, editTextCpass;
  private String firstName, lastname, mobileNumber, emailId, password, cPassword;
  private Button buttonRegister;
  public SignUpFragment() {
      // Required empty public constructor
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View view= inflater.inflate(R.layout.fragment_sign_up, container, false);
      editTextFname=(EditText) view.findViewById(R.id.f_name);
      editTextLname=(EditText) view.findViewById(R.id.l_name);
      editTextMnumber=(EditText) view.findViewById(R.id.user_mobile);
      editTextEmail=(EditText) view.findViewById(R.id.user_email);
      editTextPass=(EditText) view.findViewById(R.id.user_pass);
      editTextCpass=(EditText) view.findViewById(R.id.user_cpass);
  
      buttonRegister=(Button)view.findViewById(R.id.register_btn);
      buttonRegister.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              userRegister();
          }
      });
  
      return view;
  }
  
  private void userRegister() {
  
      String url = "...../api/Signup";
      StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
              new Response.Listener&lt;String&gt;() {
  
                  @Override
                  public void onResponse(String response) {
  
  
                      try {
                          JSONObject jObj = new JSONObject(response);
  
                          JSONObject user = jObj.getJSONObject("data");
                          String msgs = user.getString("message");
                          Toast.makeText(getContext(), "" + msgs, Toast.LENGTH_SHORT).show();
  
  
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
  
                  }
              }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
  
  
  
          }
      }) {
          @Override
          protected Map&lt;String, String&gt; getParams() {
  
  
              String fname = editTextFname.getText().toString().trim();
              String lname = editTextLname.getText().toString().trim();
              String mnumber = editTextMnumber.getText().toString().trim();
              String email = editTextEmail.getText().toString().trim();
              String pwd = editTextPass.getText().toString().trim();
              String confirmpwd = editTextCpass.getText().toString().trim();
  
              Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
              params.put("fname", fname);
              params.put("lname", lname);
              params.put("mnumber", mnumber);
              params.put("message", email);
              params.put("name", pwd);
              params.put("name", confirmpwd);
  
              return params;
          }
  
  
      };
      stringRequest.setRetryPolicy(new DefaultRetryPolicy(
              20000,
              DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
              DefaultRetryPolicy.DEFAULT_BACKOFF_MULT
      ));
      RequestQueue requestQueue = Volley.newRequestQueue(getContext());
      requestQueue.add(stringRequest);
  
  
  }
   }
  </code></pre>
  
  <p>Here is my Json Signdata</p>
  
  <p>url:-".../api/Signup" </p>
  
  <pre><code>{
  "code": 2,
  "msg": "first name is required\nlast name is required\ncontact phone is required\n",
  "details": "",
  "request": "[]"
  }
  </code></pre>
  
  <p>Here is my Json Signdata with parameter.</p>
  
  <p>url :-"..../api/Signup?first_name=ram&amp;last_name=verma&amp;email_address=ram@gmail.com&amp;password=987&amp;cpassword=987&amp;contact_phone=2222222"</p>
  
  <pre><code>  {
  "code": 2,
  "msg": "Sorry but your mobile number is already exist in our records",
  "details": "",
  "request": "{\"first_name\":\"ram\",\"last_name\":\"verma\",\"email_address\":\"ram@gmail.com\",\"password\":\"987\",\"cpassword\":\"987\",\"contact_phone\":\"2222222\"}"
  }
  </code></pre>