1

I have a problem in inheriting from base class when using AndroidAnnotations. I have a base Activity named BaseActivity:

@EActivity
public abstract class BaseActivity extends AppCompatActivity {

    @ViewById
    Toolbar toolbar;

    @ViewById(R.id.drawer_layout)
    DrawerLayout drawerLayout;

    @ViewById(R.id.nav_view)
    NavigationView navView;
}

Also i have a child activity named MainActivity:

@EActivity(R.layout.activity_main)
public class MainActivity extends BaseActivity {

    @ViewById
    ImageButton btnTabHome;
}

When i build project get following errors:

****MyProjectBuildPath****\MainActivity_.java
Error:(82, 13) error: toolbar is not public in BaseActivity; cannot be accessed from outside package

Error:(83, 13) error: drawerLayout is not public in BaseActivity; cannot be accessed from outside package

Error:(84, 13) error: navView is not public in BaseActivity; cannot be accessed from outside package

Error:(90, 9) error: cannot find symbol method initBaseViews()

If i inherit from BaseActivity_, get following errors:

****MyProjectBuildPath****\MainActivity.java
Error:(19, 35) error: cannot find symbol class BaseActivity_

Error:(17, 1) error: org.androidannotations.annotations.EActivity can only be used on an element that extends android.app.Activity

Warning:(19, 8) Element packagename.MainActivity invalidated by EActivityHandler

Where is my mistake?

1
  • have you tried declare scope of variables in BaseActivity to public and then inherit BaseActivity in MainActivty class? Commented Jan 8, 2017 at 16:30

1 Answer 1

2

Regarding to androidannotations issues page i should just change modifier of fields.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.