Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method setOnTabSelectListener() error #9

Closed
madeit22 opened this issue Apr 21, 2020 · 1 comment
Closed

method setOnTabSelectListener() error #9

madeit22 opened this issue Apr 21, 2020 · 1 comment
Labels
question Further information is requested

Comments

@madeit22
Copy link

Hi. I,m new on android and i want to use this library and i got these errors when use 1.0.5+ version of this library.

Code that got error:

animatedBottomBar.setOnTabSelectListener(new AnimatedBottomBar.OnTabSelectListener() {
@OverRide
public void onTabSelected(int lastIndex, @nullable AnimatedBottomBar.Tab lastTab, int newIndex, @NotNull AnimatedBottomBar.Tab newTab) {
Fragment fragment = null;
switch (newTab.getId()) {
case R.id.home:
fragment = new HomeFragment();
break;
case R.id.dashboard:
fragment = new DashboardFragment();
break;
case R.id.settings:
fragment = new SettingsFragment();
break;
}
if (fragment != null) {
fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.fragment_container, fragment)
.commit();
} else {
Log.e(TAG, "Error in creating Fragment");
}

Build error:

C:\Users\mohammadreza22\AndroidStudioProjects\EnergX\app\src\main\java\com\madeit\energx\MainActivity.java:34: error: <anonymous com.madeit.energx.MainActivity$1> is not abstract and does not override abstract method onTabReselected(int,Tab) in OnTabSelectListener
animatedBottomBar.setOnTabSelectListener(new AnimatedBottomBar.OnTabSelectListener() {

Logcat:

2020-04-22 01:34:14.855 7369-7369/com.madeit.energx E/m.madeit.energ: Invalid ID 0x00000975.
2020-04-22 01:34:14.874 7369-7369/com.madeit.energx E/m.madeit.energ: Invalid ID 0x00000974.
2020-04-22 01:34:14.875 7369-7369/com.madeit.energx E/m.madeit.energ: No package ID ff found for ID 0xff2196f3.
2020-04-22 01:34:14.876 7369-7369/com.madeit.energx D/AndroidRuntime: Shutting down VM
2020-04-22 01:34:14.945 7369-7369/com.madeit.energx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.madeit.energx, PID: 7369
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.madeit.energx/com.madeit.energx.MainActivity}: android.view.InflateException: Binary XML file line #8 in com.madeit.energx:layout/activity_main: Binary XML file line #8 in com.madeit.energx:layout/activity_main: Error inflating class nl.joery.animatedbottombar.AnimatedBottomBar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3333)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3477)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7464)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
Caused by: android.view.InflateException: Binary XML file line #8 in com.madeit.energx:layout/activity_main: Binary XML file line #8 in com.madeit.energx:layout/activity_main: Error inflating class nl.joery.animatedbottombar.AnimatedBottomBar
Caused by: android.view.InflateException: Binary XML file line #8 in com.madeit.energx:layout/activity_main: Error inflating class nl.joery.animatedbottombar.AnimatedBottomBar
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.madeit.energx.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:7990)
at android.app.Activity.performCreate(Activity.java:7979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3308)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3477)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7464)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0xff2196f3
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:239)
at android.content.res.Resources.getColor(Resources.java:1016)
2020-04-22 01:34:14.945 7369-7369/com.madeit.energx E/AndroidRuntime: at android.content.Context.getColor(Context.java:676)
at androidx.core.content.ContextCompat.getColor(ContextCompat.java:514)
at nl.joery.animatedbottombar.ExtensionsKt.getColorResCompat(Extensions.kt:14)
at nl.joery.animatedbottombar.AnimatedBottomBar.initAttributes(AnimatedBottomBar.kt:61)
at nl.joery.animatedbottombar.AnimatedBottomBar.(AnimatedBottomBar.kt:50)
at nl.joery.animatedbottombar.AnimatedBottomBar.(AnimatedBottomBar.kt:27)
at nl.joery.animatedbottombar.AnimatedBottomBar.(Unknown Source:6)
... 28 more

@Droppers
Copy link
Owner

Droppers commented May 1, 2020

You should also implement onTabReselected in your listener.

@Droppers Droppers closed this as completed May 1, 2020
@Droppers Droppers added the question Further information is requested label Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants