Facebook SDK:SharePhotoContent不工作
我正在开发一个应用程序,使用facebook sdk在一篇帖子中共享文本和多个图像。我使用了下面的代码,但在我的fb墙贴中没有发生任何事情。代码有什么问题,请大家帮忙。提前谢谢Facebook SDK:SharePhotoContent不工作,facebook,facebook-sdk-4.0,Facebook,Facebook Sdk 4.0,我正在开发一个应用程序,使用facebook sdk在一篇帖子中共享文本和多个图像。我使用了下面的代码,但在我的fb墙贴中没有发生任何事情。代码有什么问题,请大家帮忙。提前谢谢 private void publishImage() { ArrayList<SharePhoto> sharePhotos = new ArrayList<>(); int imageFolderSize; File imageFolder = new File(g
private void publishImage() {
ArrayList<SharePhoto> sharePhotos = new ArrayList<>();
int imageFolderSize;
File imageFolder = new File(getActivity().getExternalCacheDir(), "attachments/images");
if( imageFolder.exists()) {
imageFolderSize = imageFolder.listFiles().length;
ArrayList<File> attachments = new ArrayList<>();
if (imageFolder.exists()) {
Collections.addAll(attachments, imageFolder.listFiles());
}
if (imageFolderSize > 0) {
for (int i = 0; i < attachments.size(); i++) {
File file = attachments.get(i);
if (file.exists()) {
if (file.getAbsolutePath().endsWith(".png")) {
try {
SharePhoto photo = new SharePhoto.Builder().setBitmap(BitmapFactory.decodeFile(file.getAbsolutePath()))
.setCaption("Welcome To Facebook Photo Sharing on steroids!")
.build();
sharePhotos.add(photo);
}catch (Exception e){
RMLog.debug("Execp: e"+e.toString());
}
}
}
}
}
}
SharePhotoContent scontent = new SharePhotoContent.Builder().addPhotos(sharePhotos
).build();
if(ShareDialog.canShow(SharePhotoContent.class))
{ ShareApi.share(scontent, null);
Toast.makeText(getActivity(), "Succsesfully posted on your wall",
Toast.LENGTH_LONG).show();
}
}
private void publishImage(){
ArrayList sharePhotos=新建ArrayList();
int-imageFolderSize;
File imageFolder=新文件(getActivity().getExternalCacheDir(),“附件/图像”);
如果(imageFolder.exists()){
imageFolderSize=imageFolder.listFiles().length;
ArrayList attachments=新的ArrayList();
如果(imageFolder.exists()){
Collections.addAll(附件,imageFolder.listFiles());
}
如果(imageFolderSize>0){
对于(int i=0;i
效果很好,但我在帖子中看不到标题……请帮帮我。我只能看到墙上的图片,有没有其他方法可以将标题文本与图片一起显示、、?Facebook并不总是在新闻提要中显示标题。去检查照片的细节视图-如果它显示在那里,那么一切都正常工作,您对此无能为力。谢谢您,CBroe,但我只能看到图像,如何查看照片的细节视图。在帖子中找不到任何其他内容。“如何查看照片的详细视图”-点击它,这样照片查看器模式就会打开…是的…你是对的,但它只显示相应的图像,没有显示任何标题…谢谢你。。