1

I need the share button to share the text in the textView in this way,I am a beginner in java and android

explanation

Community
  • 1
  • 1
A.J
  • 726
  • 1
  • 7
  • 19
  • 1
    As you can see clearly, only 5 minutes of Googling gives you the result. So please try to solve issues using a search engine before involving people in solving them. – Egor Dec 02 '12 at 20:10

4 Answers4

14

on Button Click

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT,"Your score and Some extra text");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "The title");
startActivity(Intent.createChooser(shareIntent, "Share..."));
Ahmad
  • 69,608
  • 17
  • 111
  • 137
Mohsin Naeem
  • 12,542
  • 3
  • 39
  • 53
2

create a method which will be called on share button and add this lines in it

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
startActivity(Intent.createChooser(sharingIntent, "Share via"));

Try this link as well.

Cheers

Ahmad
  • 69,608
  • 17
  • 111
  • 137
Zohaib
  • 2,845
  • 2
  • 23
  • 33
1

Take a look at how to use the Intent that launches the Share Via dialog.

See this post that has your answer : Android Share Via Dialog

Community
  • 1
  • 1
Akos Cz
  • 12,711
  • 1
  • 37
  • 32
1

Here is a complete tutorial for this. http://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/

Abhishek Sabbarwal
  • 3,758
  • 1
  • 26
  • 41