小编use*_*764的帖子

通过Whatsapp或Facebook分享图像和文字

我在我的应用程序中有一个共享按钮,我想同时共享图像和文本.Gmail中工作正常,但在WhatsApp的,只有图像被发送和Facebook的应用程序崩溃.

我使用共享代码是这样的:

Intent shareIntent = new Intent(Intent.ACTION_SEND);  
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Message");         

Uri uri = Uri.parse("android.resource://" + getPackageName() + "/drawable/ford_focus_2014");
     try {
        InputStream stream = getContentResolver().openInputStream(uri);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
Run Code Online (Sandbox Code Playgroud)

如果我使用"shareIntent.setType("*/*")"Facebook和WhatsApp崩溃.

有办法做到这一点吗?也许同时发送两条消息(WhatsApp).

提前致谢.

android facebook whatsapp share-intent

24
推荐指数
3
解决办法
6万
查看次数

标签 统计

android ×1

facebook ×1

share-intent ×1

whatsapp ×1