Android: Facebook sdk ShareLinkContent shareDialog Nullpointer exception

327 просмотра

1 ответ

943 Репутация автора

I am using facebook sdk jar file in eclipse to share link with content.

I create the app id in face book and add in manifest

Manifest

<meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="xxxxxxxxxx" />

    <provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="com.facebook.app.FacebookContentProviderxxxxxxxxx"
        android:exported="true" />

    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />

But when i try to share in fb am getting Null pointer exception

java.lang.NullPointerExceptionat java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:883)

the code that am using for share is

 ShareLinkContent linkContent = new ShareLinkContent.Builder()
                        .setContentTitle("How to share content")
                        .setImageUrl(Uri.parse("https://www.numetriclabz.com/wp-content/uploads/2015/11/114.png"))
                        .setContentDescription(
                                "simple LinkedIn integration")
                        .setContentUrl(Uri.parse("https://www.numetriclabz.com/android-linkedin-integration-login-tutorial/"))
                        .build();


                shareDialog.show(linkContent); 

can anyone please tell me where am wrong

Автор: Binil Surendran Источник Размещён: 19.07.2016 06:04

Ответы (1)


1 плюс

56 Репутация автора

Sorry for late reply.
Please try this

in oncreate method before setContentView(R.layout.home);

FacebookSdk.sdkInitialize(mContext);

in on create method

ShareDialog shareDialog = new ShareDialog(getApplicationContext()); 
Автор: Rahul Размещён: 22.09.2016 06:15
Вопросы из категории :
32x32