EnderNicky
EnderNicky

Reputation: 322

Android Studio: Facebook show.(content) not working

I am using Facebook SDK 4.0 on my Android Studio. In my application I have a button which is supposed to share an image to Facebook, using set 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 click the button this stuff 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 what might help?

Upvotes: 3

Views: 331

Answers (1)

Skullper
Skullper

Reputation: 775

I'm sorry for my late answer. But I have just faced with your problem. In my case I forgot to add FacebookContentProvider into AndroidManifest file. I hope it will help other.

Upvotes: 1

Related Questions