public int coderesult (String urlstring) throws Exception {
URL url = new URL(urlstring);
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
//System.out.println("Response code is " + httpCon.getResponseCode());
int mycode = httpCon.getResponseCode();
return mycode;
}
public int displaycode() {
int dispcode = 0;
try {
dispcode = coderesult(myurl);
}
catch (MalformedURLException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}finally {
}
return dispcode;
}
Android Studio zeigt Fehler in "dispcode = coderesult (myurl);" : „Unbehandelte Ausnahme: java.lang.Exception“Unbehandelte Ausnahme bei Aufruf von HttpURLConnection
Post voll stacktrace schreiben und spezifisch sein. Was hast du mit diesem 'httpCon.getResponseCode()' bekommen? –