Null Pointer exception in using support library share action provider

后端 未结 3 812
时光取名叫无心
时光取名叫无心 2021-01-04 06:06

Below is the code of my Activity . In this I am using the support library appcompat

   import android.content.Intent;
   import android.os.Bundle;
   import          


        
3条回答
  •  鱼传尺愫
    2021-01-04 06:36

    If this line

    shareAction.setShareIntent(shareIntent);
    

    is throwing a NullPointerException, this sentence

    (ShareActionProvider) MenuItemCompat.getActionProvider(item);
    

    must be returning null.

    Have a look at the post below, which talks about reasons why this would happen.

    NullPointerException on setShareIntent using ActionBarSherlock

提交回复
热议问题