Skip to content
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.

EView's onDetachedFromWindow call super.onAttachedToWindow not super.onDetachedFrom Window #2056

Closed

Description

@RobinLJB

I found a bug that when I create an EView and I overwrite onDetachedFromWindow method.

Then, the generated Class's onDetachedFromWindow method will call super.onAttachedToWindow
instead of super.onDetachedFromWindow .

so, I lookup the package "androidannotations-4.3.0.jar" and found that ,
in this class org.androidannotations.holder.EViewHolder
source code

then I fixed this method and change onAttachedToWindowMethod to onDetachedFromWindowMethod locally and it worked

AndroidAnnotations version: 4.3

Android compile SDK version: 26.0.1

your code
@OverRide
protected void onDetachedFromWindow() {
bus.unregister(this);
super.onDetachedFromWindow();
}

Expected generated code:
@OverRide
public void onDetachedFromWindow() {
getContext().unregisterReceiver(onActionDiscoveryStartedReceiver_);
getContext().unregisterReceiver(onActionDiscoveryFinishedReceiver_);
getContext().unregisterReceiver(onActionStateChangedReceiver_);
super.onDetachedFromWindow();
}

Actual generated code:
@OverRide
public void onDetachedFromWindow() {
getContext().unregisterReceiver(onActionDiscoveryStartedReceiver_);
getContext().unregisterReceiver(onActionDiscoveryFinishedReceiver_);
getContext().unregisterReceiver(onActionStateChangedReceiver_);
super.onAttachedToWindow();
}

Activity

  1. WonderCsabo commented on Oct 30, 2017

    @WonderCsabo
    Member

    Nice catch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions