如何從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;
}
請發佈您的logcat,以便我們可以幫助您更多。 – k0sh