Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement