Android sending post data to webservice [duplicate]
问题 This question already has answers here : How to fix 'android.os.NetworkOnMainThreadException'? (56 answers) Closed 6 years ago . Hi I'm trying to send data to a webservice String url = "https://www.myurl.com"; URL urlobj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) urlobj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); String urlParameters = GenerateUrlParameters(data); con.setDoOutput(true); con