解决方法
有一些方法来实现这一点.一个可以简单地打开
http://twitter.com,并在单一的意图中分享推文,如..
- Intent tweet = new Intent(Intent.ACTION_VIEW);
- tweet.setData(Uri.parse("http://twitter.com/?status=" + Uri.encode(message)));//where message is your string message
- startActivity(tweet);
要么,
- Intent tweet = new Intent(Intent.ACTION_SEND);
- tweet.putExtra(Intent.EXTRA_TEXT,"Sample test for Twitter.");
- startActivity(Intent.createChooser(share,"Share this via"));
要么,
- String tweetUrl = "https://twitter.com/intent/tweet?text=WRITE YOUR MESSAGE HERE &url="
- + "https://www.google.com";
- Uri uri = Uri.parse(tweetUrl);
- startActivity(new Intent(Intent.ACTION_VIEW,uri));