Scene cannot be cast to android.content.ComponentCallbacks
See original GitHub issue在使用依赖注入框架 Koin 注入 ViewModel 时报 ClassCastException 异常,是否应该为 Scene 继承 ComponentCallbacks
接口https://github.com/bytedance/scene/blob/3dc15e1f2e5ce0acc662c65613475ee386341a24/library/scene/src/main/java/com/bytedance/scene/Scene.java#L112
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
android callback fails in fragment fails cannot be cast to ...
Here, you're trying to cast gpsu to a Context . It's is not one; it's a Fragment . You should pass the Context...
Read more >ComponentCallbacks2 - Android Developers
Extended ComponentCallbacks interface with a new callback for finer-grained memory management. This interface is available in all application components ...
Read more >BaseArFragment | Sceneform (1.15.0) - Google Developers
Called when a touch event is dispatched to a scene. void. onRequestPermissionsResult(int requestCode, String[] permissions, int[] results).
Read more >core/java/android/app/Activity.java - platform/frameworks/base
activity on-screen, though it may not be in the foreground and interacting ... Retrieve the {@link Scene} representing this window's current content.
Read more >ActivityGroup Class (Android.App) - Microsoft Learn
If this activity is being destroyed because it can not handle a configuration parameter ... Retrieve the Scene representing this window's current content....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you would like to use two frameworks together, you should define a new extension then you can use the koin framework with scene framework.
After you created the extension you can use like code shown below.
另外一种是自己写一个LifecycleOwner.getKoin()的扩展方法。然后通过getkoin().getViewModel(lifecycleowner…)手动实现一个viewmodl代理方法。