Android ActionBar API, getSupportActionBar() and setDisplayHomeAsUpEnable meaning? -
i added icon on action bar. , when click on it, opens activity via intent. however, in source, people add getsupportactionbar , setdisplayhomeasupenable. if without those, still works.
my question meaning og these 2 api?
if have included actionbar or toolbar in activity , if want go previous activity on tap of back arrow on left side (in ltr configuration) of actionbar, have first actionbar as,
actionbar ab = getsupportactionbar(); and provide action go previous activity , have call setdisplayhomeasupenabled() method as,
if (ab != null) { ab.setdisplayhomeasupenabled(true); }
Comments
Post a Comment