When i used Actionbarsherlock
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case android.R.id.home:
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
I notice that android.R.id.home is from API 11. How can we make sure android.R.id.home is right on API 8?
It is a static final constant which means its value is copied into the compiled code instead of being just a reference. This is why it is able to be used successfully on every API level.
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