title: Android Volley library on LocalHost error
body: <p>Volley library getting error (can't connect to server) when running on localhost my web-service is in asp.net. working perfectly on browser but not in android device where I am wrong please help me. I am new in android  </p>
  
  <pre><code>public static final String JSON_URL="http://localhost:1462/Service1.svc/GetCities";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
      btn = (Button) findViewById(R.id.btn);
      linearLayoutManager = new LinearLayoutManager(this);
      final MyAdapter ma = new MyAdapter(this, list);
      recyclerView.setLayoutManager(linearLayoutManager);
      recyclerView.setAdapter(ma);
  
      requestQueue = Volley.newRequestQueue(this);
      /////////////////////////////////////////////////////////////
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(JSON_URL, new Response.Listener&lt;JSONArray&gt;() {
                  @Override
                  public void onResponse(JSONArray response) {
                      Toast.makeText(MainActivity.this, "Response", Toast.LENGTH_SHORT).show();
  
                      try {
                          if (response.length() &gt; 0) {
                              Toast.makeText(MainActivity.this, "Geting Response", Toast.LENGTH_SHORT).show();
                              list.clear();
                              for (int i = 0; i &lt; response.length(); i++) {
                                  JSONObject jsonObject = response.getJSONObject(i);
                                  Hotels h = new Hotels();
                                  if (!jsonObject.isNull("City")) {
                                      h.CityName = jsonObject.getString("City");
                                  }
  
                                  list.add(i, h);
                              }
                              ma.notifyDataSetChanged();
                          }
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              }, new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      // do something
                      Toast.makeText(MainActivity.this, "Cant connect to server", Toast.LENGTH_SHORT).show();
                  }
              });
  
              requestQueue.add(jsonArrayRequest);
          }
      });
  }
  </code></pre>