Soft Back button for Android Activity -
as per design rule idea introduce button activity in android?
i believe every device, days, or running android os has hardware button.
what suggestion on implementing software button?
how can enable it, if @ hardware button support not present?
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //enable soft button actionbar ab =getsupportactionbar(); ab.setdisplayhomeasupenabled(true); } //handle click event @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if(id==android.r.id.home){ onbackpressed(); return true; } return super.onoptionsitemselected(item); }
hope helps you!
Comments
Post a Comment