ittianyu / BottomNavigationViewEx

An android lib for enhancing BottomNavigationView. 一个增强BottomNavigationView的安卓库。
MIT License
3.47k stars 558 forks source link

api v19 null pointer exception #140

Closed olegsvs closed 6 years ago

olegsvs commented 6 years ago

Hi, i have error:

java.lang.NullPointerException
        at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.getBottomNavigationItemViews(BottomNavigationViewEx.java:569)
        at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.setTextVisibility(BottomNavigationViewEx.java:244)

inject:

    @BindView(R.id.fr_main_bottom_nav)
    BottomNavigationViewEx bottomNav;

And any method from BottomNavigationEx return null pointer, for example bottomNav.setTextVisibility(false);

ittianyu commented 6 years ago

Please check you lib version and choose one.

  1. old version support lib is 25 or 26
    compile 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
    compile "com.android.support:design:26.+"
  2. new version support lib = 28
    implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.2'
    implementation "com.android.support:design:28.0.0"
  3. AndroidX use new version,and add config into gradle.properties
    android.useAndroidX=true
    android.enableJetifier=true
olegsvs commented 6 years ago

@ittianyu, thx you, i used 28 support lib and old version BottomNavigationViewEx. Thx for awesome lib and fast answer)

Benvanj commented 5 years ago

good day, ittianyu

I have a similiar problem and have found your solutions posted all over the web... but even after I follow your solutions I have problems... could you please assist? or are you supporting the library.. Thanks: error: java.lang.NullPointerException: Attempt to invoke virtual method 'com.ittianyu.bottomnavigationviewex.BottomNavigationViewInner com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.enableAnimation(boolean)' on a null object reference...