21
20

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.

【Android】Twitter、Facebook、Google+に簡単に共有する方法

Last updated at Posted at 2014-05-10

Twitter、Facebook、Google+等に共有する場合、独自に実装しているアプリを多くみかけますが、暗黙的Intentを使うと簡単です。

Google PlayやYouTubeなどの公式アプリもこの暗黙的Intentを使用して共有機能を実装しているようです。

device-2014-05-10-115304.png


try {
	Intent intent = new Intent();
	intent.setAction(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, "共有する文言");
    startActivity(Intent.createChooser(intent, "共有する"));
} catch (Exception e) {
}                


たったこれだけです。

21
20
0

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
21
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?