Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从我的应用程序在facebook上发布照片时获取空点异常_Android_Facebook - Fatal编程技术网

Android 从我的应用程序在facebook上发布照片时获取空点异常

Android 从我的应用程序在facebook上发布照片时获取空点异常,android,facebook,Android,Facebook,我得到以下错误: Java.Lang.NullPointerException:在尝试发布照片时,尝试在空对象引用上调用虚拟方法“void com.facebook.share.widget.ShareDialog.show(Java.Lang.Object)” 这是我的代码: Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);

我得到以下错误:

Java.Lang.NullPointerException:在尝试发布照片时,尝试在空对象引用上调用虚拟方法“void com.facebook.share.widget.ShareDialog.show(Java.Lang.Object)”

这是我的代码:

 Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
                                    SharePhoto sharePhoto = new SharePhoto.Builder().setBitmap(image).build();


                                    SharePhotoContent content = new SharePhotoContent.Builder()
                                    .addPhoto(sharePhoto)
                                    .build();
                                    shareDialog.show(content);

消息上说,
shareDialog
为空,您需要在前面的代码中对此进行检查。谢谢..我以前没有初始化它。。