Wenn verbunden Website mit HttpURLConnection Um die Ausgabe anzuzeigen, in dem AndroidWenn verbunden Website mit HttpURLConnection im Android die Ausgabe angezeigt wird Das Ergebnis kommt auf Formcode
Das Ergebnis kommt als html
Was dieses Problem verursacht
Runnable runnable = new Runnable() {
@Override
public void run() {
try {
URL insertUserUrl = new URL("http://ayman.unaux.com/?i=1");
HttpURLConnection insertConnection = (HttpURLConnection) insertUserUrl.openConnection();
InputStreamReader resultStreamReader = new InputStreamReader(insertConnection.getInputStream());
BufferedReader resultReader = new BufferedReader(resultStreamReader);
final String result = resultReader.readLine();
final String d =result.toString();
runOnUiThread(new Runnable() {
@Override
public void run() {
TextView text = (TextView) findViewById(R.id.s);
// WebView webView = (WebView) findViewById(R.id.w);
// webView.loadUrl(d);
text.setText(d);
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
};
Thread thread = neuer Thread (runnable); thread.start();
Ich habe mehr als einen Standort experimentieren und das gleiche Ergebnis geben – ayman2011a
Mehr als eine Website oder die gleiche Website, aber mehrere Pfade? HTTPUrlConnection ist nicht das Problem. Probieren Sie '' https://stackoverflow.com '' –