Search code examples
androidsharemime

how to develop a share button to share a link?


for example i want to share this link:

http://www.orientaldaily.com.my/index.php?option=com_k2&view=item&id=6780:&Itemid=198

Here is the code

private void shareIt() {
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    String shareBody = "Here is the share content body";
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
            "Subject Here");
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
    startActivity(Intent.createChooser(sharingIntent, "Share via"));
}

So,

1) how to make it to share a link to facebook?

2) how to edit the share list?


Solution

  • Once you hand the text off to the system with createChooser() its out of your hands.

    1. It is upto user's choice, by which mean (app/source) they choose to share.
    2. You cannot change the list of sharing application. (It is managed by system)