我如何从 onCreate() 内部调用该函数...我想从 oncreate() 调用 CreateSharedactionprovider() 但应用程序崩溃...我没有正确调用该函数还是缺少一些争论
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
// Show the Up button in the action bar.
setupActionBar();
CreateSharedactionprovider();
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public boolean CreateSharedactionprovider(Menu menu){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
// Locate MenuItem with ShareActionProvider
MenuItem item = menu.findItem(R.id.menu_share);
// Fetch and store ShareActionProvider
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
doShare();
}
return true;
}