Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@OptionsItem for android.R.id.home causes lint error #1981

Copy link
Copy link
@ened

Description

@ened
Issue body actions

AndroidAnnotations version:

4.2.0

Android compile SDK version:

Support libs: 25.3.0

Annotated code:

    @OptionsItem(android.R.id.home)
    void homeClicked() {
        finish();
    }

Expected generated code:

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId_ = item.getItemId();
        if (itemId_ == android.R.id.home) {
            homeClicked();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

Actual generated code:

    import android.R;

    ...

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId_ = item.getItemId();
        if (itemId_ == R.id.home) {
            homeClicked();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

lint warning:

Don't include android.R here; use a fully qualified name for each usage instead

Seems to be new in Android Tools 23.3.

(or maybe I shouldn't listen for that button at all! 😄)

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.