Thursday, February 8, 2018

How to share Text in Android

In Android, we can share a text, image anr many thing things.

In the post we will learn how to share text in Android.

To do this we need an Object of class Intent and set action " android.intent.action.SEND"


Intent localIntent = new Intent();
    localIntent.putExtra("android.intent.extra.TEXT", "Text To Share");
    startActivity(Intent.createChooser(localIntent, "Share..."));

It will open a chooser doalog with many options like SMS, Whatsapp, Mail, facebook etc,  in which user can select any option.

No comments:

Post a Comment