Caused by: java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor
Bitmap bmp =BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
String str = "";
Canvas canvas = new Canvas(bmp); //此句报错
canvas.drawText(str, , , paint);
不允许直接修改res里面的图片,只要在后面加上.copy(Bitmap.Config.ARGB_8888, true);
修改后:
Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.a).copy(Bitmap.Config.ARGB_8888, true);
Caused by: java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor的更多相关文章
- android 图片叠加效果——两种方法的简介与内容 ,带解决Immutable bitmap passed to Canvas constructor错误
第一种是通过canvas画出来的效果: public void first(View v) { // 防止出现Immutable bitmap passed to Canvas constructor ...
- Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError
SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackO ...
- 【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8
spring boot整合elasticsearch, 启动报错: Caused by: java.lang.IllegalStateException: availableProcessors ], ...
- Caused by: java.lang.IllegalStateException: Method has too many Body parameters
feign多参数问题1.1GET方式错误写法 @RequestMapping(value="/test", method=RequestMethod.GET) Model test ...
- Caused by:java.lang.IllegalStateException at android.media.MediaPlayer._setDataSource(Native Method)
使用Mediaplayer播放本地音频,在第二次调用mediaplayer.setDataSource()时报错如下: Caused by: java.lang.IllegalStateExcepti ...
- Caused by: java.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$Match
spring 4.0.2,mybatis 3.2.6,aspectjweaver 1.8.10 使用的时候,报错: Caused by: java.lang.IllegalStateException ...
- Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord(一)
Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.x ...
- Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.co ...
- Caused by: java.lang.IllegalStateException: duplicate key: datasource
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/applicatio ...
随机推荐
- js 实现自动调出键盘
在app中,在页面加载完成之后,给输入框添加一个focus,不能自动调出软键盘,可以用以下方式实现: //触发键盘 $("#content").on("touchstar ...
- 5.6 WebDriver API实例讲解(31-40)
31.判断页面元素是否存在 public static void testElementExist(){ driver.get("http://www.sogou.com"); t ...
- 分享知识-快乐自己:Spring线程池配置
Spring通过ThreadPoolTaskExecutor实现线程池技术,它是使用jdk中的Java.util.concurrent.ThreadPoolExecutor进行实现. Spring 配 ...
- SFTP 利用对称公钥免密码的方法
在客户端的操作: #cd .ssh 进入.ssh目录 #ssh-keygen -t rsa 执行创建密钥对命令 Generating public/private rsa ...
- hdu-2544-最短路(SPFA模板)
题目链接 题意很清晰,入门级题目,适合各种模板,可用dijkstra, floyd, Bellman-ford, spfa Dijkstra链接 Floyd链接 Bellman-Ford链接 SPFA ...
- 20165210 预习作业3 Linux安装及学习
Linux安装及学习 一.Linux安装 通过参考教程:基于VirtualBox虚拟机安装Ubuntu图文教程成功的安装上了Linux但在过程中还是有一些小问题的. 首先按着步骤走,一开始没什么毛病, ...
- FMDB的操作(转),这篇比我写的好
直接看吧 http://blog.devtang.com/blog/2012/04/22/use-fmdb/
- 使用Visio画UML模型
Microsoft Office Visio“UML 模型图” 模板为创建复杂软件系统的面向对象的模型 (模型:建模系统的一种抽象表示,它从特定的视角并在某一抽象级别上指定建模系统.) 提供全面的支持 ...
- url参数的编码解码Demo
为了保证在页面传递数据的安全性,我们通常会对Url传递的参数进行编码解码操作.我们写一个Demo剖析URL编码解码过程. 完整Demo下载地址 1. Url参数如何在服务端进行编码和解码. 1.1 U ...
- UVALive - 3521 Joseph's Problem (整除分块)
给定$n,k$$(1\leqslant n,k\leqslant 10^9)$,计算$\sum\limits _{i=1}^nk\: mod\:i$ 通过观察易发现$k\%i=k-\left \lfl ...