53
53

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Twitterに共有するIntentの書き方

Last updated at Posted at 2014-03-06

##やりたいこと

  • Twitterに共有する機能を実装する
  • そのためだけにTwitter認証したくない
  • 普通の共有IntentだとTwitter関連に絞れない

##やり方
Twitterで共有する用のURLを使う

####https://twitter.com/share?text=[共有したいテキスト]

sample
String url = "https://twitter.com/share?text=hogehoge"
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);

このようにするとTwitter共有のリンクに対応するアプリのみ表示される。

簡単!

53
53
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
53
53

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?