当前位置:网站首页>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边栏推荐
- Unity项目优化案例一
- From the 18th line to the first line, the new story of the network security industry
- Record a jar package conflict resolution process
- 深入理解 SQL 中的 Grouping Sets 语句
- Processing strategy of message queue message loss and repeated message sending
- 【LeetCode】94. Middle order traversal of binary tree
- 特征多项式与常系数齐次线性递推
- Add color to the interface automation test framework and realize the enterprise wechat test report
- 1287. Elements that appear more than 25% in an ordered array
- Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
猜你喜欢

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)

TCP拥塞控制详解 | 3. 设计空间

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

Détails du contrôle de la congestion TCP | 3. Espace de conception

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

arduino-esp32:LVGL项目(一)整体框架

Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package

【LeetCode】94. Middle order traversal of binary tree

There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them

What is the maximum number of concurrent TCP connections for a server? 65535?
随机推荐
《天天数学》连载56:二月二十五日
Explore Cassandra's decentralized distributed architecture
TCP congestion control details | 3 design space
[combinatorics] combinatorial identity (sum of variable upper terms 1 combinatorial identity | summary of three combinatorial identity proof methods | proof of sum of variable upper terms 1 combinator
Chinese translation of Tagore's floating birds (1~10)
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
Multithread 02 thread join
Explore Netease's large-scale automated testing solutions see here see here
Develop team OKR in the way of "crowdfunding"
nifi从入门到实战(保姆级教程)——flow
Client does not support authentication protocol requested by server; consider upgrading MySQL client
Svn usage specification
Golang 装饰器模式以及在NSQ中的使用
Register in PHP_ Globals parameter settings
SVN使用规范
The mixlab editing team is recruiting teammates~~
(Supplement) double pointer topic
Mb10m-asemi rectifier bridge mb10m
Aike AI frontier promotion (7.3)
Basis of target detection (IOU)