Reputation: 1883
I am developing an application in which I want to implement the twitter API and also have to load the particular URL, is it possible to load the particular URL from the API implementation? Please give me suggestion.
Thanks in advance.
Upvotes: 1
Views: 2157
Reputation: 2106
You could use: http://twitter4j.org/en/index.html or https://github.com/sugree/twitter-android-sdk
Or something like:
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
HttpResponse response;
String output ="";
try {
response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
//IOUtilities is a class by romanian guy...
output = IOUtilities.readString(instream);
instream.close();
}
} catch (ClientProtocolException e) {
} catch (IOException e){
Log.e(TAG, "ERROR: Failed to open GET_REQUEST "+ e);
}
Upvotes: 2