Android Studio: Facebook display (content) not working

I am using Facebook SDK 4.0 on my android studio. In my application, I have a button that is supposed to share an image to Facebook using the given content.

 Bitmap h = BitmapFactory.decodeResource(getResources(),R.drawable.redsmall);

SharePhoto photo = new SharePhoto.Builder()
        .setBitmap(h)

        .build();

SharePhotoContent contentP = new SharePhotoContent.Builder()
        .addPhoto(photo)
        .build();
shareDialog.show(contentP);

      

When I press the button, it happens!

Process: com.inc.nicky.tapit, PID: 2968
java.lang.IllegalStateException: Could not execute method of the activity
        at android.view.View$1.onClick(View.java:3969)
        at android.view.View.performClick(View.java:4637)
        at android.view.View$PerformClick.run(View.java:19422)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5586)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.reflect.InvocationTargetException

 Caused by: java.lang.NullPointerException

      

Any ideas that might help?

+3


source to share


1 answer


I am sorry for my late reply. But I just ran into your problem. In my case, I forgot to add the FacebookContentProvider to the AndroidManifest. Hope this helps others.



+1


source







All Articles