i am trying to download JSON file from url using this follwing code,
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
} catch (Exception e) {
Log.e("log_tag", "Error in http connection " + e.toString());
}
However, android studio showing that HttpClient, DefaultHttpClient, HttpPost is depricated. I've tried googling for all the above deprecated options and as many other variations as I can think of and can't find any useful results, so I'm obviously missing something.
what is the correct way to download json file from url