Using OKHttp3
// It is used to get JsonData from URL new AsyncTask<Void, Void,String>() { @Override protected String doInBackground(Void... voids) { OkHttpClient okHttp = new OkHttpClient(); Request request = new Request.Builder().url("https://api.github.com/users/ashokslsk").build(); try { Response response = okHttp.newCall(request).execute(); System.out.println("ResponseRupal:::::" + response.body().string()); return "Hi"; } catch (IOException e) { e.printStackTrace(); } return null; } }.execute();
Comments
Post a Comment