问题描述
|
我正在开发一个应用程序,在该应用程序中我想实现twitter API并且还必须加载特定的URL,是否可以从API实现中加载特定的URL?请给我建议。
提前致谢。
解决方法
您可以使用:http://twitter4j.org/en/index.html或https://github.com/sugree/twitter-android-sdk
或类似的东西:
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);
}