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

13

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
  • 64,492
  • 17
  • 108
  • 135
Mohsin Naeem
  • 12,407
  • 3
  • 38
  • 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
  • 64,492
  • 17
  • 108
  • 135
Zohaib
  • 2,807
  • 2
  • 22
  • 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,581
  • 1
  • 36
  • 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
  • 24
  • 40