Android上的Twitter API实现

问题描述

| 我正在开发一个应用程序,在该应用程序中我想实现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);
}
    

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...