2011-01-28 40 views
0

在我的應用程序中,我需要發佈推文,我該怎麼做?我發現了一個jar,但它的構造函數已被棄用。如何使用Android應用程序發佈推文?

+0

此鏈接可能會使用http://twitter4j.org/zh/index.html http://twitter4j.org/zh/index.html http://www.winterwell.com/software/jtwitter.php – 2011-01-28 07:59:05

回答

0

只使用一個[發送意圖] [1],這樣用戶可以決定他們想與你的消息做什麼:

Intent shareIntent = new Intent( android.content.Intent.ACTION_SEND); 
shareIntent.setType("text/plain"); 
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,」Sharing info"); 
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, 」is very easy this way」); 
startActivity(Intent.createChooser(shareIntent, 」Share Track")); 
0

,如果你只需要發佈;然後是上面顯示的parag鏈接; twitter4j和winterwell就足夠了。

否則你需要看看OAuth,這是一個痛苦。這是推特(以及facebook和LinkedIn等)「確認用戶和密碼的新方式」。

http://apiwiki.twitter.com/w/page/22554657/OAuth-Examples在這種情況下將是有用的。

祝你好運,玩得開心! :)

+0

如果您只需要發佈,發送意圖的是最好,最無痛的方式! – LordT 2011-01-30 21:07:59

+0

true,true ...:D – dedmau5 2011-02-01 07:00:46

0

您可以發送appropriate Intent:請求ACTION_SEND,然後根據已知應用程序包的列表限制符合條件的意圖。