在android上获取最后一条推文(API 1.1)

在android上获取最后一条推文(API 1.1),android,twitter,androidhttpclient,Android,Twitter,Androidhttpclient,我使用以下方法制作android应用程序: public JSONObject lastTweet(String username) throws ClientProtocolException, IOException, JSONException { String url = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=hodorhodorhodor"; HttpClient cli

我使用以下方法制作android应用程序:

public JSONObject lastTweet(String username) throws ClientProtocolException, IOException, JSONException {
    String url = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=hodorhodorhodor";
    HttpClient client = new DefaultHttpClient();    
    HttpGet get = new HttpGet(url);
    HttpResponse response = client.execute(get); //cannot execute this line
    int status = response.getStatusLine().getStatusCode();
    //Some more code
}
当我运行应用程序时,我得到一个错误,即应用程序已停止工作。经过一些调试后,我发现以下是我的应用程序卡住的那一行(我在上面的代码中也提到了这一行):

HttpResponse response = client.execute(get);
在线搜索之后,我发现它与twitterapi1.1有关,twitterapi1.1需要某种OAuth身份验证。有人能帮我吗

谢谢。

,到目前为止,API 1.1中的所有方法都需要使用OAuth,这留下了一些限制

您可以使用接收访问令牌,如库中所述:只需实现TwitterOAuthView.Listener和call start()方法

此外,这是一个关于使用twitter访问令牌登录和编写twitter更新的完整教程

希望这有帮助