我正在创建一个应用。它有一个文本框和一个图像框。一旦用户填写了这些框,他点击“make this a fb post”按钮。然后我希望我的应用程序打开Facebook移动应用程序作为意图。应使用文本和图像创建新的“准备发布”帖子。这有可能实现吗?如果是的话,请你让我知道。如果不是,是否有另一种方式。
答案 0 :(得分:1)
试试此代码
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"))
答案 1 :(得分:0)
我建议您使用Facebooks Share Dialog。 所以你可以一步完成你的目标。