我正在通过Skype与链接和图像共享文本,但是唯一的图像而非文本被共享。请帮帮我,我进行了很多搜索,但没有得到任何有用的解决方案。
}
//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) {
}
});
答案 0 :(得分:0)
ACTION_SEND –此意图将启动“发送活动”。
setType(“ image / ”)–我们必须设置发送数据的类型,即对于图像,它是“ image / ”。
putExtra(Intent.EXTRA_STREAM,imagePath)–放置Extra将使用我们共享的图像的路径名放置多余的流。
startActivity(Intent.createChooser(sharingIntent,“使用共享图像”))–现在以标题名称开始选择器活动。
例如:
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);