title: progress dialog in android when login is success
body: <p>This is my Login class i need to display a progress dialog when the user click on login button. how to  set a progress dialog and where to use it</p>
  
  <pre><code>          private void login(){
  
            //Getting values from edit texts
          final String email = editTextEmail.getText().toString().trim();
          final String password = editTextPassword.getText().toString().trim();
  
      //Creating a string request
      StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.LOGIN_URL,
              new Response.Listener&lt;String&gt;() {
  
                  @Override
                  public void onResponse(String response) {
  
                      //If we are getting success from server
                      if(response.equalsIgnoreCase(Config.LOGIN_SUCCESS)){
  
                          //Creating a shared preference
                          SharedPreferences sharedPreferences = Login.this.getSharedPreferences(Config.SHARED_PREF_NAME, Context.MODE_PRIVATE);
  
                          //Creating editor to store values to shared preferences
                          SharedPreferences.Editor editor = sharedPreferences.edit();
  
                          //Adding values to editor
                          editor.putBoolean(Config.LOGGEDIN_SHARED_PREF, true);
                          editor.putString(Config.EMAIL_SHARED_PREF, email);
                         //Saving values to editor
                          editor.apply();
  
                          //Starting profile activity
                          Intent intent = new Intent(Login.this, MainActivity.class);
                          Toast.makeText(Login.this, "Welcome", Toast.LENGTH_SHORT).show();
                          startActivity(intent);
                      }
                      else if (editTextEmail.getText().toString().equals(""))
                      {
                          editTextEmail.setError("Enter your email");
                          editTextEmail.requestFocus();
                      }
                      else if(!validateEmail(editTextEmail.getText().toString())) {
                          editTextEmail.setError("Invalid EmailId");
                          editTextEmail.requestFocus();
                          //inputLayoutEmail.setError(getString(R.string.close));
                          //return false;
                          //requestFocus(editTextEmail);
  
                      }
  
                      else if(editTextPassword.getText().toString().equals(""))
                      {
                          editTextPassword.setError("Invalid password");
                      }
                      else
                      {
                          //If the server response is not success
                          //Displaying an error message on toast
                          Toast.makeText(Login.this, "Your UserName/Password Wrong\n please verify", Toast.LENGTH_SHORT).show();
                      }
  
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      //You can handle error here if you want
  
                  }
              }){
          @Override
          protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
              Map&lt;String,String&gt; params = new HashMap&lt;&gt;();
              //Adding parameters to request
  
              params.put(Config.KEY_EMAIL, email);
              params.put(Config.KEY_PASSWORD, password);
  
              //returning parameter
              return params;
  
          }
      };
  
      //Adding the string request to the queue
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      requestQueue.add(stringRequest);
  }
  
  @Override
  public void onClick(View v) {
  
      ProgressDialog loading;
  
      //Calling the login function
  
      login();
  
  }
  </code></pre>
  
  <p>I need to show a loading option of progress dialog when user clciks on lgin button</p>