2011-01-28 82 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,然后根据已知应用程序包的列表限制符合条件的意图。