ShareActionProvider is null

前端 未结 2 1092
萌比男神i
萌比男神i 2021-02-06 20:15

I have been searching for 3 or 4 days about a solution on this. I have tried: Null Pointer exception in using support library share action provider or why MenuItemCompat.getAct

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-06 20:39

    You could just create a ShareActionProvider and assign it.

    mShareActionProvider = new ShareActionProvider();
    mShareActionProvider.setShareIntent(createShareIntent())
    MenuItemCompat.setActionProvider(item, mShareActionProvider);
    

提交回复
热议问题