我正在创建一个应用程序。它有一个文本框和一个图像框。用户填写完这些内容后,他单击“将其设为 fb 帖子”按钮。然后我希望我的应用程序作为 Intent 打开 facebook 移动应用程序。应使用文本和图像创建新的“准备发布”帖子。这是否可以实现。如果是的话,你能告诉我路吗?如果不是,是否有替代方法。
最佳答案
试试这段代码
File filePath = getFileStreamPath("shareimage.jpg"); //optional. use your image path
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, _text);
shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File(filePath))); //optional//use this when you want to send an image
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"))
;
关于android - 打开新帖子作为意向 - Facebook 移动版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47628376/