android - button id is not getting in custom action bar -
i trying add custom action bar fragment
public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub view view = inflater.inflate(r.layout.fragment_createblog, container,false); android.app.actionbar actionbar = getactivity().getactionbar(); actionbar.setcustomview(r.layout.actionbar_createblog); actionbar.setdisplayshowcustomenabled(true); actionbarblogcreation = (button) view.findviewbyid(r.id.button_actionbarblog); actionbarblogcreation.setonclicklistener(this); } });
my action bar changed, while trying take button id layout shows null. why happening ?
i think should try next:
actionbar.setcustomview(r.layout.actionbar_createblog); actionbar.setdisplayshowcustomenabled(true); actionbarblogcreation = (button) actionbar.getcustomview().findviewbyid(r.id.button_actionbarblog);
Comments
Post a Comment