isnonety
isnonety

Reputation: 93

ActionBarsherlock android.R.id.home <API 11

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?

Upvotes: 9

Views: 1903

Answers (1)

Jake Wharton
Jake Wharton

Reputation: 76115

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.

Upvotes: 8

Related Questions