Search code examples
androidactionbarsherlock

Reference android.R.id.home on pre 3.0 devices


Is there an easy way to get a reference to the home button on devices running less then 3.0?

I can do findViewById(android.R.id.home) on 3.0 and later but that fails to work on older devices. I don't need to listen for clicks, I just need its location to position another view.

For clarification I'm referring to this view: http://developer.android.com/guide/topics/ui/actionbar.html#Home


Solution

  • I don't know what you're doing... but it sounds hacky :)

    getWindow().getDecorView().findViewById(android.R.id.home)