Android Studio:Facebook表演.(内容)不起作用 [英] Android Studio: Facebook show.(content) not working

查看:111
本文介绍了Android Studio:Facebook表演.(内容)不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android Studio上使用Facebook SDK 4.0.在我的应用程序中,我有一个按钮,应该使用设置的内容将图像分享到Facebook.

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?

推荐答案

很抱歉我的回答很晚. 但是我刚刚面对您的问题.就我而言,我忘记将FacebookContentProvider添加到AndroidManifest文件中. 希望对其他人有帮助.

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.

这篇关于Android Studio:Facebook表演.(内容)不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆