当前位置:网站首页>Widget uses setimageviewbitmap method to set bug analysis
Widget uses setimageviewbitmap method to set bug analysis
2022-06-30 02:01:00 【Handsome good man_ Jack】
widget Inside ImageView Component settings bitmap problem
stay widget Inside ,Imageview Set up bitmap when , You can usually use
RemoteViews.setImageViewBitmap(R.id.imageview, bitmap)
to update ImageView, Using this method can easily cause the following problems :
AppWidgetHostView: Error inflating RemoteViews : android.widget.RemoteViews$ActionException: android.widget.RemoteViews$ActionException: view: androidx.appcompat.widget.AppCompatImageView can't use method with RemoteViews: setImageBitmap(class android.graphics.Bitmap)
From the above error log analysis, the general meaning is ,AppCompatImageView Can't be in RemoteViews It uses setImageBitmap This method
But why?remoteViews Clearly provided setImageViewBitmap, Now I say it can't be used
Analysis of a : This error log “can’t use method with RemoteViews” Where did it come from ?

method The essence is ImageView Of setImageBitmap Method ,klass.getName() Theoretically, what should be returned is ImageView, Because we are layout The components inside are ImageView; But from the log, it is AppCompatImageView, This is the key ; And this sentence :
method.isAnnotationPresent(RemotableViewMethod.class)
intend method If there are comments on this method , And the notes contain RemotableViewMethod This class returns true, Return if not included false;
Let's see. ImageView Of setImageBitmap:
It does , explain ImageView There is no problem ; That reflects a problem from the log side ,kclass.getName() Indeed, the return is not ImageView It is a AppCompatImageView
Question why
Mingming RemoteViews The layout provided layout Inside is a ImageView, But in setImageBitmap Time is a AppCompatImageView; It is found that the general reason is AppCompatImageView yes ImageView Compatible types of , A lot of optimization , So sometimes the system will ImageView Replace with AppCompatImageView, And this AppCompatImageView Of setImageBitmap The method is not about RemotableViewMethod Annotations , So you get an error ;
solve
Put about AppCompat Library removal of , see build.gradle It introduces appcomapt library
implementation 'androidx.appcompat:appcompat:1.3.1'
Delete this line of dependent libraries , The new compilation problem is solved ;
边栏推荐
- 208. implement trie (prefix tree) - attach detailed notes
- Varnish foundation overview 7
- Using face_ Recognition library reports an error reason: cudnn_ STATUS_ NOT_ SUPPORTED
- Tools and life services
- Cookie encryption 10
- Comprendre le principe AQS (organigramme et schéma de file d'attente synchrone)
- 手势数字启蒙学习机
- Summary of DOM
- Understand AQS principle (flow chart and synchronous queue diagram)
- Upload, use of Avatar
猜你喜欢

C语言 我要通过

AI landing manufacturing: intelligent robots should have these four abilities

Cookie encryption 13

Chiffrement des cookies 8

Unity2D--给动画添加关键帧并绑定事件

Cookie encryption 15 login encryption
![[MRCTF2020]Ezpop-1|php序列化](/img/65/9b7a3ae3552d8784b0c77a1130d762.png)
[MRCTF2020]Ezpop-1|php序列化

C language output integer in another format

JS content confusion, return content encryption

一次 Keepalived 高可用的事故,让我重学了一遍它!
随机推荐
Using grpcui to test asp Net core grpc service
001_ layout
Pytoch modifies the hook source code to obtain per layer output parameters (with layer name)
Let‘sPlayCurling
002_ container
App test related tools
OpenCV和Image之间的转换(亲测有效)
Varnish foundation overview 7
MySQL monitoring 5
A keepalived high availability accident made me learn it again!
Cookie encryption 9
scp远程拷贝命令记录
Understand AQS principle (flow chart and synchronous queue diagram)
[graph neural network] overview of graph classification learning [2]: graph classification based on graph neural network
Cookie encryption 10
Tools and life services
[MySQL 05] SUSE 12 SP5 modifies the MySQL password for the first time after installing MySQL
Varnish foundation overview 8
widget使用setImageViewBitmap方法设置bug分析
Varnish foundation overview 3