Reputation: 3080
I want to share my android application link on simple button click to facebook as well as twitter. basically I want to share some custom text and my application link of market.
So what i have to do to achieve this?
Any suggestion will be appreciated.
Upvotes: 2
Views: 4312
Reputation: 403
Solution
1.I f you wan to share you application link from your android application to facebook, twitter and any other social media.
implementation 'com.github.premsingh8171:updateappOnplayStore:1.0.0'
repositories {
maven { url 'https://jitpack.io'
}
More details follow link: https://github.com/premsingh8171/updateappOnplayStore
Upvotes: 0
Reputation: 11
btnShare = (Button)findViewById(R.id.btnShare);
btnShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plan");
String sharBody = "Body";
String shareSub = "Subject";
intent.putExtra(Intent.EXTRA_SUBJECT,shareSub);
intent.putExtra(Intent.EXTRA_TEXT,shareSub);
startActivity(intent.createChooser(intent,"Share Using")); }
});
}
Add your custom things in Subject.
Upvotes: 1
Reputation: 4676
String message = "Text I want to share."
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));
As documented in the answer found at Android - Share on Facebook, Twitter, Mail, ecc
Upvotes: 1