2011-05-26 80 views
1

我正在開發一個應用程序,我想要實現twitter API並且還必須加載特定的URL,是否可以從API實現中加載特定的URL?請給我建議。Android上的Twitter API實現

在此先感謝。

回答

2

你可以使用:http://twitter4j.org/en/index.htmlhttps://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); 
} 
+0

感謝您的答覆,但我必須實現從我還沒有實現從無到有的API。請爲我提供一些教程來實現Twitter的API。 – 2011-05-26 13:55:12

+0

感謝這一點,但我已經看到這個我已經下載了本教程給出的文件,並將這個jar文件存儲在我的應用程序中,因爲它們在本教程中有所體現,但他們無法解釋進一步的步驟。所以你可以給我另一個教程的鏈接,將它保存在我的應用程序中後,應該用jar文件完成什麼。 – 2011-05-26 14:09:37

+0

http://twitter4j.org/en/code-examples.html這裏給出一些例子。 – Nallath 2011-05-26 14:19:12