-3

I want to share the string on whatsapp with share button on dialog by using oncicklistener.can anybody help me out with this.

1 Answers1

0

Inside your setOnclickListenerdo something like this,

        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        String shareBody = "your string";
        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "your header text");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, "your title"));

This is basically sending a short message with a subject line , body and a title.

Sash_KP
  • 5,551
  • 2
  • 25
  • 34