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.

The onPrepareOptionsMenu method may be called before Bean-objects injection. #1308

Copy link
Copy link
@maximzhemerenko

Description

@maximzhemerenko
Issue body actions

Usually onPrepareOptionsMenu method is called after all bean-objects have been injected, but in Android 4.1.1, 4.1.2 and possibly in other versions it happens vice versa.
This unexpected behavior may cause NullPointerException.

Method init_(Bundle savedInstanceState) (in generated class that extends Activity or Fragment) calls setHasOptionsMenu(true), which may have different implementations in various Android versions.
In this case it calls onPrepareOptionsMenu method immediately, but in Android 4.2+ versions onPrepareOptionsMenu call is postponed.
That's why it would be better to improve AndroidAnnotations lib to exclude calling onPrepareOptionsMenu method before bean-objects (and others) are injected.

In development we are using AndroidAnnotations version of 3.2.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    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.