android – Sending message through installed applications – Education Career Blog

I would like to share a url from my android application. I would like to share this url through the installed applications in my device(bluetooth, facebook, google mail, messaging etc.).

Given below is the code

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class SendURL extends Activity {
    /** Called when the activity is first created. */
    Button button;

    public void onCreate(Bundle savedInstanceState) {
        button = (Button) findViewById(;
        button.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent picMessageIntent = new Intent(

                 * //Code for sending image
                 * picMessageIntent.setType("image/jpeg"); File downloadedPic =
                 * new
                 * File("/sdcard/download/"+"1287567819_Einstein_1_JPEG.jpg");
                 * picMessageIntent.putExtra(Intent.EXTRA_STREAM,
                 * Uri.fromFile(downloadedPic));

                        "Send your url using:"));

When I press a button called share, the installed applications in the phone which can share this url, should be listed like this. The user can select an application from this list and share the url through the chosen application(gmail, facebook, messaging etc.).
With the given code, I get only gmail and bluetooth. I do not get facebook, messaging etc. Please advise, in order that I can send the url through all the applications in the phone which are capable of doing this.

Any help in this regard is appreciated.
Looking forward,


Try adding a subject and some text – at the moment you’re not sharing a url, just creating a blank message.

Try something like this:

Intent picMessageIntent = new Intent(
picMessageIntent.putExtra(Intent.EXTRA_SUBJECT, "my url subject");
picMessageIntent.putExtra(Intent.EXTRA_TEXT, "Go to url: "+"");

startActivity(Intent.createChooser(picMessageIntent, "Send your url using:"));

Replace "my url subject" and "Go to url " +"" with the subject and url you wish to share.

Leave a Comment