Created
September 1, 2015 13:02
-
-
Save dineshr93/5457933c553fced07cb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hanselandpetal.catalog; | |
| import org.apache.http.HttpResponse; | |
| import org.apache.http.client.methods.HttpGet; | |
| import org.apache.http.util.EntityUtils; | |
| import android.net.http.AndroidHttpClient; | |
| public class HttpManager { | |
| public static String getData(String uri) { | |
| AndroidHttpClient client = AndroidHttpClient.newInstance("AndroidAgent"); | |
| HttpGet request = new HttpGet(uri); | |
| HttpResponse response; | |
| try { | |
| response = client.execute(request); | |
| return EntityUtils.toString(response.getEntity()); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| return null; | |
| } finally { | |
| client.close(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment