0

I am sharing text with link and image through skype but the only image is getting shared not text. please help me out, i searched a lot but didn't get any helpful solution.

}
//apath is path to image
final Uri picUri = FileProvider.getUriForFile(mContext,
getFileProviderAuthority(),
new File(aPath));
sendIntent.setData(picUri);
sendIntent.setType("image/*");
sendIntent.putExtra(Intent.EXTRA_STREAM, picUri);
mContext.startActivity(Intent.createChooser(sendIntent, mContext.getResources().getText("share via")));
msg = "text msg with url";
final Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        sendIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        //sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
        LoggerD.debugLog("share message- " + msg);
        sendIntent.putExtra(Intent.EXTRA_TEXT, msg);
        
PicassoUtil.with(mContext).load(aPath, new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
    Uri picUri = getLocalBitmapUri(bitmap,mContext);
    sendIntent.setData(getLocalBitmapUri(bitmap,mContext));
    sendIntent.setType("image/*");
    sendIntent.putExtra(Intent.EXTRA_STREAM, picUri);
    mContext.startActivity(Intent.createChooser(sendIntent, mContext.getResources().getText(R.string.send_to)));
}

@Override
public void onBitmapFailed(Drawable errorDrawable) {

}

@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {

}
});

1 Answers1

-1

ACTION_SEND – This intent will start the Send Activity.

setType(“image/”) – We have to set type of send data i.e. for image it is” image/”.

putExtra(Intent.EXTRA_STREAM, imagePath) – Put extra will put the extra stream with the path name of image that we are sharing.

startActivity(Intent.createChooser(sharingIntent, “Share Image Using”)) – Now start chooser activity with title name.

For Example:

    Intent intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    intent.putExtra(Intent.EXTRA_TEXT,"My Sales");
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.setType("image/png");
    startActivity(intent);
Krishna Vyas
  • 1,009
  • 8
  • 25
  • 1
    Its not working!!! Ii have added all elements already, it is not working .. only image is getting shared with this code ( issue is with skype only). i want to share both text and image... – Amrik Singh Padam Dec 27 '19 at 10:36
  • Unfortunately, Not all third party apps implement expected Intent handling on their end. Skype is one of them. You can exclude skype from chooser or leave it as it is, with a hope they might fix it sometime in a future – Krishna Vyas Dec 27 '19 at 10:51