title: Android Application works correctly on emulator but crashes on real device
body: <p>I'm developing an android application which use MySQL database and json, it works on emulator correctly but when im launching it on my device (Galaxy S5) I'm facing a force close 
  Here is my request to server and get json objects: </p>
  
  <pre><code>    btnFaalSazi.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
              String validatePhoneNumber = phoneNumber.getText().toString();
              if (validatePhoneNumber.matches("^(?:0\\d{10}|9\\d{9})$")) {
  
                  txtError.setText("");
                  structUsers.register_number = phoneNumber.getText().toString();
                  String phone = structUsers.register_number;
  
                  Log.i("LOG", phone);
                  Log.i("LOG", "HELOOOOOO");
  
                  final ArrayList&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
                  params.add(new BasicNameValuePair("register_number", phone));
  
                  String result = Webservice.readUrl("http://192.168.10.110:2233/api/register", params);
  
                  if (result != null) {
                      try {
                          G.users.clear();
                          JSONObject object = new JSONObject(result);
                          String status = object.optString("status");
                          String code = object.optString("code");
                          String message = object.optString("message");
  
                          Log.i("LOG", "status hast " + status);
                          Log.i("LOG", "code hast  " + code);
                          Log.i("LOG", "mesage hast  " + message);
  
                          if (status != null &amp;&amp; code != null) {
                              if (Integer.parseInt(status) == -1) {
                                  Intent intent = new Intent(ActivityRegisterNumber.this, ActivityRegisterCode.class);
                                  intent.putExtra("REGISTERNUMBER", structUsers.register_number);
                                  ActivityRegisterNumber.this.startActivity(intent);
                              }
                          }
  
                          if (status != null &amp;&amp; message != null) {
                              if (Integer.parseInt(status) == 100) {
                                  Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
                                  Log.i("LOG", "after error 100");
                              } else if (Integer.parseInt(status) == 101) {
                                  Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
                                  Log.i("LOG", "after error 101");
                              } else if (Integer.parseInt(status) == 102) {
                                  Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
                                  Log.i("LOG", "after error 102");
                              } else if (Integer.parseInt(status) == 103) {
                                  Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
                                  Log.i("LOG", "after error 103");
                              }
                          }
                      }
                      catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              } else {
                  txtError.setText("Wrong phone number");
              }
  
          }
      });
  </code></pre>
  
  <p>I think application crashes when its going to perform this line : </p>
  
  <pre><code>                    String result = Webservice.readUrl("http://192.168.10.110:2233/api/register", params);
  </code></pre>
  
  <p>and this is my webservice module : </p>
  
  <pre><code>public class Webservice {
  
  public static String readUrl(String url, ArrayList&lt;NameValuePair&gt; params) {
  
      try {
  
          HttpClient client = new DefaultHttpClient();
          HttpPost method = new HttpPost(url);
  
          if (params != null) {
              method.setEntity(new UrlEncodedFormEntity(params));
          }
  
          HttpResponse response = client.execute(method);
  
          InputStream inputStream = response.getEntity().getContent();
          String result = convertInputStreamToString(inputStream);
  
          return result;
      }
      catch (ClientProtocolException e) {
          e.printStackTrace();
      }
      catch (IOException e) {
          e.printStackTrace();
      }
  
      return null;
  }
  
  
  public static String convertInputStreamToString(InputStream inputStream) {
      try {
          BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
          StringBuilder builder = new StringBuilder();
  
          String line = "";
  
          while ((line = reader.readLine()) != null) {
              builder.append(line);
          }
  
          return builder.toString();
      }
      catch (IOException e) {
          e.printStackTrace();
      }
  
      return null;
  }
  }
  </code></pre>