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.
dplante
2,4513 gold badges21 silver badges27 bronze badges
asked May 26, 2011 at 13:32
Amandeep singh
1,8837 gold badges21 silver badges41 bronze badges
1 Answer 1
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);
}
Sign up to request clarification or add additional context in comments.
4 Comments
Amandeep singh
Thanks for the Response, But i have to implement the API from the scratch I haven't implement. Please provide me some tutorial to implement API for Twitter.
Amandeep singh
Thanks for this but i have already view this i had download the file which is given in this tutorial and store the jar file in my application as they mensioned in this tutorial but they cannot explain the further steps. so can you give me link of another tutorial what is tobe done with jar file after save it in my appllication.
Amandeep singh
please provide me the code which you send me before to call the URL.
blackjack
but any way thanks for the code found in github.com/sugree/twitter-android-sdk which help me to login using fragment only but not activity so can i make changes to some classes to achieve some other feature of twitter
default