android


Android ActionBar API, getSupportActionBar() and setDisplayHomeAsUpEnable meaning?


I added a icon on the action bar. And when i click on it, it opens another activity via intent. However, in some source, people add getSupportActionBar and setDisplayHomeAsUpEnable. Even if without those, it still works.
My question is what is the meaning og these 2 API?
If you have included actionBar or toolbar in your activity and if you want to go to previous activity on the tap of back arrow on the left side (in LTR configuration) of your actionbar, you will have to first get actionbar as,
ActionBar ab = getSupportActionBar();
and then provide action which is go to previous activity and for that you will have to call setDisplayHomeAsUpEnabled() method as,
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}

Related Links

Which Camera class should I use if my minimum API level is < Marshmallow (21)?
Proguard excluding classes from a library
Android Volley with app engine backend
How to place tab layout after toolbar?
tools:showIn causing error in Android layout
How can I restrict background data in Android programmatically?
Glide RequestListener not working
A little misunderstanding on intent - android
Is it possible to compile Xamarin for Android from Linux CLI?
Progress bar freeze on setVisibility change
Adding IF statement into each array index value in MulitSelectList preference
How to detect when user left home place and when arriving home?
Android studio showing nothing to show
GCM ReconnectManager does not reconnect automatically if 3G is switched on after a long time
DatePickerDialog open the current date
Positioning elements on android GridLayout

Categories

HOME
shell
xml
design-patterns
rdbms
jmx
youtube-data-api-v3
mysql-workbench
oracle-apex-5
error-handling
can
entity-framework-core
big-o
emscripten
web-hosting
google-admin-sdk
nstableheaderview
openpyxl
openbugs
entitymanager
imessage
poedit
guzzle
resourcebundle
siri
licensing
jackson-modules
progress-bar
genexus-sd
bioinformatics
iis-express
winpe
corenlp-server
panoramas
paragraph
batching
imagenet
cin
azure-arm
parser-generator
apache-directory
apache-spark-dataset
vaadin-charts
jquery-ui-draggable
manova
filehandle
skin
check-mk
mach-o
java-websocket
cudd
actor-platform
vulcanize
x-tag
jboss-tools
freepbx
mediametadataretriever
riot
php-socket
findfirst
crouton-os
jnlua
canvg
teamcity-9.1
xmltype
iiop
ghcjs
sql-scripts
spy++
with-statement
parallel-testing
rcaller
ios8-extension
draw2d-js
authlogic
decoupling
dsym
artemis
ebay-lms
cnf
android-icons
superscrollorama
intersect
web-farm
zope.interface
iboutlet
lambdaj
hibernateexception
user-tracking
saxparseexception
exponentiation
rmdir
creole
mbeans
quotation-marks
lalr
xslcompiledtransform
blind

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App