当前位置:网站首页>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 overwriteViewGroupMethods , 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边栏推荐
- Client does not support authentication protocol requested by server; consider upgrading MySQL client
- 特征多项式与常系数齐次线性递推
- 8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
- [combinatorics] combinatorial identities (sum of variable terms 3 combinatorial identities | sum of variable terms 4 combinatorial identities | binomial theorem + derivation to prove combinatorial ide
- 面试之 top k问题
- 一台服务器最大并发 tcp 连接数多少?65535?
- 程序猿如何快速成长
- Mb10m-asemi rectifier bridge mb10m
- Expression of request header in different countries and languages
- Golang anonymous function use
猜你喜欢

8 cool visual charts to quickly write the visual analysis report that the boss likes to see

NSQ源码安装运行过程

ThreeJS 第二篇:顶点概念、几何体结构

Visual SLAM algorithms: a survey from 2010 to 2016

NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon

一台服务器最大并发 tcp 连接数多少?65535?

Interviewer: how does the JVM allocate and recycle off heap memory

2022爱分析· 国央企数字化厂商全景报告

Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day

2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
随机推荐
初试scikit-learn库
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
(Supplement) double pointer topic
Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
Cocos Creator 2. X automatic packaging (build + compile)
There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them
Is it safe to open an account with tongdaxin?
特征多项式与常系数齐次线性递推
Basis of target detection (IOU)
Initial test of scikit learn Library
MongoDB 的安装和基本操作
Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
如何在本机搭建SVN服务器
Pointcut expression
Expression of request header in different countries and languages
Pyinstaller is not an internal or external command, nor is it a runnable program or batch file
QT serial port UI design and solution to display Chinese garbled code
中南大学|通过探索理解: 发现具有深度强化学习的可解释特征
Myopia: take off or match glasses? These problems must be understood clearly first
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..