Although this question has been asked multiple times in StackOverflow and I went through many of them, still I couldn't resolve my issue or I am not able to find out the root cause of the issue. Hence, posting a new question.
Below are the list of links I went through --
protected Void doInBackground(Void... params)
HttpURLConnection connection = null;
URL url = new URL("http://10.0.2.2:8080/android_connect/user_registration.php");
connection = (HttpURLConnection)url.openConnection();
OutputStreamWriter output = new OutputStreamWriter(connection.getOutputStream());
HttpResult = connection.getResponseCode();
I have figured out the reason why it was not working. There were two issues --
The IP Address was not correct. So I changed the IP Address from
10.0.2.2 to the
Also the port number 8080 was not correct. I have set my own port number in
httpd.conf file, like
##Listen 220.127.116.11:8383Listen 0.0.0.0:8383Listen [::0]:8383##, under Apache and I used the same.
After changing both and re-starting the WAMP server, it worked like a charm.