当前位置:网站首页>Preventing/catching “IllegalArgumentException: parameter must be a descendant of this view” error
Preventing/catching “IllegalArgumentException: parameter must be a descendant of this view” error
2022-07-03 16:30:00 【French red wine sweet】
problem :
I have a ListView with some focusable components inside (mostly EditText
s). I have one ListView There are some components that can be focused ( Mainly EditText
s).Yeah, I know this isn't exactly recommended, but in general, almost everything is working fine and the focus goes where it has to go (with a few tweaks I had to code). Yes , I know this is not completely recommended , But on the whole , Almost everything is normal , And focus on where it has to go ( I have to code some adjustments ).Anyway, my problem is that there's a weird race condition when scrolling the list with your finger and then suddenly using the trackball when the IME keyboard is being displayed . in any case , My problem is when I scroll through the list with my finger and Showing IME Keyboard time Suddenly use the trackball when There will be strange competitive conditions .Something must go out of bounds and get recycled at which point the offsetRectBetweenParentAndChild()
method must kick in and throw the IllegalArgumentException
. Something has to cross the border and be recycled , here offsetRectBetweenParentAndChild()
Method must be started and thrown IllegalArgumentException
.
The problem is that this exception is thrown outside of any block in which I can insert a try/catch (as far as I know). The problem is that this exception is when I can insert try/catch Thrown outside any block of ( as far as I am concerned ).So there are two valid solutions to this question, either: So there are two effective solutions to this problem , or :
- Someone knows why this exception being thrown and how to stop it from happening Someone knows Why? Throw this exception and how to prevent it from happening
- Someone knows how to put a try/catch block somewhere that will at least let my application survive. Someone knows how to try/catch The block is placed where my application can at least survive .As far as I know the problem is that of focus, so it definitely shouldn't kill my application (which is what it's doing). as far as I am concerned , The problem is the focus , So it should never kill my application ( This is what it is doing ).I tried overriding the
ViewGroup
's methods but those twooffset*
methods are marked as final. I try to overwriteViewGroup
Methods , But these twooffset*
Method is marked as final.
Stack trace: stack trace :
08-17 18:23:09.825: ERROR/AndroidRuntime(1608): FATAL EXCEPTION: main08-17 18:23:09.825: ERROR/AndroidRuntime(1608): java.lang.IllegalArgumentException: parameter must be a descendant of this view08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:2633)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:2570)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1624)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.draw(ViewRoot.java:1357)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.os.Handler.dispatchMessage(Handler.java:99)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.os.Looper.loop(Looper.java:130)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at android.app.ActivityThread.main(ActivityThread.java:3683)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at java.lang.reflect.Method.invokeNative(Native Method)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at java.lang.reflect.Method.invoke(Method.java:507)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)08-17 18:23:09.825: ERROR/AndroidRuntime(1608): at dalvik.system.NativeStart.main(Native Method)
Solution :
Reference resources : https://stackoom.com/en/question/TnB5边栏推荐
- Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
- PHP CI(CodeIgniter)log级别设置
- 跟我学企业级flutter项目:简化框架demo参考
- The mixlab editing team is recruiting teammates~~
- NSQ source code installation and operation process
- Nine ways to define methods in scala- Nine ways to define a method in Scala?
- One article takes you to understand machine learning
- Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
- 记一次jar包冲突解决过程
- Visual SLAM algorithms: a survey from 2010 to 2016
猜你喜欢
TCP拥塞控制详解 | 3. 设计空间
Learn from me about the enterprise flutter project: simplified framework demo reference
TCP congestion control details | 3 design space
NSQ源码安装运行过程
Basis of target detection (IOU)
ThreeJS 第二篇:顶点概念、几何体结构
Multithread 02 thread join
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
What is the maximum number of concurrent TCP connections for a server? 65535?
关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM
随机推荐
To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
Is it safe to open an account with flush?
Qt插件之自定义插件构建和使用
疫情常态化大背景下,关于远程办公的思考|社区征文
Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
Thinking about telecommuting under the background of normalization of epidemic | community essay solicitation
Unreal_DataTable 实现Id自增与设置RowName
8 tips for effective performance evaluation
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
[proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
记一次jar包冲突解决过程
Myopia: take off or match glasses? These problems must be understood clearly first
Netease UI automation test exploration: airtest+poco
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
Effect of ARP package on FTP dump under vxworks-6.6 system
Colab works with Google cloud disk
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Mysql 将逗号隔开的属性字段数据由列转行
14 topics for performance interviews between superiors and subordinates (4)