HttpClient httpclient = new DefaultHttpClient(); // Prepare a request object HttpGet httpget = new HttpGet(args[0]); httpget.addHeader("Authorization", "Bearer " + BearerToken); // Execute the request HttpResponse response; JSONArray arr = new JSONArray(); try { response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null && response.getStatusLine().getStatusCode() == 200) { // A Simple JSON Response Read InputStream instream = entity.getContent(); String result = convertStreamToString(instream); arr=new JSONArray(result); instream.close(); } } catch (ClientProtocolException e) { // TODO Auto-generated catch block Log.e("EXCEPTION",e.toString()); } catch (IOException e) { // TODO Auto-generated catch block Log.e("EXCEPTION",e.toString()); } catch (JSONException e) { // TODO Auto-generated catch block Log.e("EXCEPTION",e.toString()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)