I've called setDisplayHomeAsUpEnabled(true) and the arrow is showing, but it goes no where, I'd also like to manually set the link/target of the button to go to a custom location.
How can I specify a custom location? Thankyou.
Thanks
If you are using ActionBarSherlock like the title says, you should instead use:
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Either way, to handle the click, you have to make a case for android.R.id.home
in onOptionsItemSelected()
Eg:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
//do your own thing here
return true;
default: return super.onOptionsItemSelected(item);
}
}
Also, by custom location, I don't know what you mean, you can certainly make a new Intent()
to do something.
However, to keep things consistent with the Android guidelines, you should be using the Up icon to actually go up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With