Comments (13)
@dpeters-ipc Could you please in Fragment try to use viewLifecycleOwner
?
from balloon.
@egorikftp
I will check about it more and I will try to fix it in the next release.
Thank you for your issue :)
from balloon.
Don't use the applicationcontext for building the balloon. Instead, use your activity's context.
from balloon.
I use getContext() of Fragment
from balloon.
As you can see from the exception, the balloon could not get the activity's context. It should be called in onViewCreated (after onCreateView) and it will be better to check the activity is still alive.
val activity = getActivity() ?: return
showAsDropDown..
from balloon.
Hi, I tried this in a new release, but it wasn't enough. The crash still occurs.
I will add !activity.isDestroyed() && !activity.isFinishing() in the next release.
But it could still happen because you call PopupWindow.showAsDropDown from a Handler. This is asynchronous and the activity-state might have changed. So some checks in the Balloon code would be an improvement for stability I think.
from balloon.
@dpeters-ipc
Do you use setLifecycleOwner
using the activity's lifecycle as a parameter?
from balloon.
I'm using setLifecycleOwner(this) where this is the Fragment instance
from balloon.
@dpeters-ipc
Hi, I changed the Handler using the main looper in the new version 1.1.6.
If the same issue will happen and if the crashes are serious, the dismissWithDelay
functionality will be removed. Thank you :)
from balloon.
It's included in the new version 1.1.8.
Thank you for your issue :)
from balloon.
@skydoves Looks like with viewLifecycleOwner
we have crash in the latest version using by balloon()
delegate.
java.lang.IllegalStateException: Can't access the Fragment View's LifecycleOwner when getView() is null i.e., before onCreateView() or after onDestroyView()
at androidx.fragment.app.Fragment.getViewLifecycleOwner(Fragment.java:353)
from balloon.
Hi, @egorikftp.
As you can see from the log, I think the balloon is used before onCreateView()
or after onDestroyView()
.
Could you please give me more details about your use cases?
from balloon.
I call balloon after onViewCreated()
, not reproduced on 1.1.7 version.
class SubCategoryFragment : Fragment(R.layout.fragment_catalog) {
private val binding: FragmentCatalogBinding by viewBinding()
private val viewHolderBalloon by balloon(ViewHolderBalloonFactory::class)
private var subcategoryController: SubCategoryController by Delegates.notNull()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
subcategoryController = SubCategoryController(
onCatalogItemClick = {
},
onTrendingClick = {
viewHolderBalloon?.showAlignLeft(it)
}
)
}
}
from balloon.
Related Issues (20)
- Content window right spacing truncating inside widget
- Working with ImageSpan HOT 6
- Check box inside layout custom menu. HOT 1
- Show next and previous item data without dismiss in recyclerview HOT 2
- Prevent Balloon on theme changed HOT 1
- Compose: provide the way to get the end of the sequentially showed balloons. Still not working after 1.6.3 HOT 3
- Shadow have its left and right shadow clipped HOT 5
- Getting some stuttering when doing fast scrolling. HOT 1
- The balloon is swallowing keyboard input. HOT 2
- can i set width and height dynamically? HOT 3
- Compose Balloon position is misplace HOT 6
- Compose elements with `fillMaxWidth()` are cut on the edge HOT 2
- Arrow is not showing HOT 9
- Corner radius not set properly HOT 2
- PopupWindow not seen By Appium HOT 4
- Make popup reappear in `onResume` after being dismissed in `onPause` HOT 1
- ArrowOrientation.BOTTOM and END not working in M3 ModalBottomSheet
- request a Gaussian Blur overlay HOT 1
- How can I blur the overlay? HOT 1
- Support Compose Multiplatform
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from balloon.