I ve just upgraded my Android application from api level 13 to 14, using simulator 4.0.
Can anyone that is using level 14 api confirm that there is a problem with
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item)
{
switch(item.getItemId())
{
case android.R.id.home:
...
}
function ? If i compile with level 13 api, i can click on the main activity icon ( left up) and i go to this method in r.id.home case, but with upgrading to api level 14 that function is not called and it looks like the icon is not clickable :(
I am just wondering if it is a bug in this just newly released api..
From the Action Bar documentation:
Note: If you're using the icon to navigate to the home activity, beware that beginning with Android 4.0 (API level 14), you must explicitly enable the icon as an action item by calling setHomeButtonEnabled(true) (in previous versions, the icon was enabled as an action item by default).
I'm not sure about the overload you're using for onOptionsItemSelected. The Android reference shows that the only overload is onOptionsItemSelected(MenuItem) and the following is definitely working for me:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
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