-
Notifications
You must be signed in to change notification settings - Fork 43
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
crash sometime happened #12
Comments
Can you give more information about the issue like when it happens, or maybe post the stack trace. |
Hello |
more likely not setting the |
Can you reproduce the issue, if so please mention the steps to reproduce. |
I can't promise you the steps that might reproduce the same error. I have two projects that use the same component. One is just a test app with your package to test, while as other is a production app. Both use the same code and same versions of navigation fragment. But the test works fine but not the production app since even tho all the code is the same. We can get on a meet where I can show you the issue if you want to. |
Ok, let's talk on skype. Can you give me your skype id? |
Or you can attach some videos of it. |
Sorry, can I get back to you on monday |
Its fine, you can upload a video and I will take a look |
Hello,
My fix for this was to write my own menuItemClickListener and remove the navListener, where I think the problem lies. binding.cbnvHome.setMenuItems(menuItems, 2)
binding.cbnvHome.setOnMenuItemClickListener { cbnMenuItem, index ->
if (cbnMenuItem.destinationId == -1) {
throw RuntimeException("please set a valid id, unable the navigation!")
}
val builder = NavOptions.Builder()
.setLaunchSingleTop(true)
.setEnterAnim(R.anim.nav_default_enter_anim)
.setExitAnim(R.anim.nav_default_exit_anim)
.setPopEnterAnim(R.anim.nav_default_pop_enter_anim)
.setPopExitAnim(R.anim.nav_default_pop_exit_anim)
// pop to the navigation graph's start destination
builder.setPopUpTo(findStartDestination(navController.graph).id, false)
val options = builder.build()
try {
navController.navigate(cbnMenuItem.destinationId, null, options)
} catch (e: IllegalArgumentException) {
Log.w("HOME", "unable to navigate!", e)
}
} obviously, any directions from the But a blank Project with just this much works fine. package com.jeevan.bottomnavigation
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.findNavController
import np.com.susanthapa.curved_bottom_navigation.CbnMenuItem
import np.com.susanthapa.curved_bottom_navigation.CurvedBottomNavigationView
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
override fun onStart() {
super.onStart()
val cbnv : CurvedBottomNavigationView = findViewById(R.id.nav_view)
val menuItems = arrayOf(
CbnMenuItem(
R.drawable.ic_download, // the icon
R.drawable.anim, // the AVD that will be shown in FAB
R.id.downloadFragment // optional if you use Jetpack Navigation
),
CbnMenuItem(
R.drawable.ic_instagram,
R.drawable.anim,
R.id.instagramFragment
),
CbnMenuItem(
R.drawable.ic_post_saver,
R.drawable.anim,
R.id.postSaverFragment
),
CbnMenuItem(
R.drawable.ic_tools,
R.drawable.anim,
R.id.toolFragment
),
)
cbnv.setMenuItems(menuItems)
cbnv.setupWithNavController(findNavController(R.id.nav_host_fragment))
}
}
|
The stack trace suggests that you are setting |
sorry that was the wrong stack trace, here is the correct one
|
Upon further inspection, I have realised that setting the active index while initializing the menuItems like this solves my issue.
This works because setup navController calls
since the selectedIndex is equal to index it works. but otherwise this function is executed and inside this function there is some code with AnimatorSet
start throws mee the error. |
hope this is helpful |
Thanks for the information. I will fix this issue when I have some free time.Until then you can use your work around. |
i am getting the issue of Caused by: android.content.res.Resources$NotFoundException: why my resource png file is not showing |
This library is built to work with AnimatedVectorDrawable, if you are passing anything other than AVD, then it won't work. |
So after inspection I think I found the problem. The problem is that the home destination that have been setup in |
ok thanks it works now but i want to be the selected icon fully inside the bottom bar but here it is half outside is there any way |
Can you attach some screenshots and also the code that you have used to setup the bottom navigation. |
there is no problem with the design it is as in the image shown here but i want the icon completely inside the bottom bar but in your design half of the selected item is outside and half is inside the bottom bar i want the selected item to be completely inside the bottom bar |
Sorry this is currently not supported. |
Is there any solution for this @susonthapa ? |
Can you post some screen shot of the design that you are trying to replicate? |
Hi Susonthapa, |
I haven't been able to look into this, does the workaround fixes your issue? |
Came here looking for a solution because we saw the same stack trace in crash reporting. We are unable to reproduce the issue locally to figure what exactly is going wrong. Here is an issue tracker that may receive some guidance at some point https://issuetracker.google.com/issues/234749373 |
@susonthapa |
I had the same issue. I solved it like this Firstly I am using it with navContoller and toolbar, so whatever your startDestination, that will be your index in the bottomNav For Example: startDestination: notificationFragment and bottomNav.setMenuItems(menuItems, 1) |
@anitanTIC
This is most likely caused by the mismatch of IDs between the navigation graph and the index passed to I haven't looked into this library in a while and with Jetpack Compose becoming the standard I don't know how useful this library is. |
.UnsupportedOperationException: Sorting went bad, the start event should always be at index 0
The text was updated successfully, but these errors were encountered: