2013-06-27 31 views
0

我使用的用於製作Android應用以下方法:獲取Android上最後的鳴叫(API 1.1)

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); 

經過一番網上搜索,我發現,它已得到做的事twitter API 1.1需要某種OAuth身份驗證。任何人都可以在這裏幫我嗎?

謝謝。

回答