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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -