Perform the same in this
private class LongOperation extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String response = HttpRequest.get("http://google.com").body();
System.out.println("Response was: " + response);
return response ;
}
@Override
protected void onPostExecute(String result) {
}
@Override
protected void onPreExecute() {}
@Override
protected void onProgressUpdate(Void... values) {}
}
Start it in your onCreate like this new LongOperation().execute(“”);
2
solved I get NetworkOnMainThreadExeption when using kevinsawickis http-request class [duplicate]