Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
来源:互联网 发布:excel筛选两列重复数据 编辑:程序博客网 时间:2024/04/28 22:56
重写surfaceView时出现异常
Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
出错的代码块如下:
public ProgressView(Context context) { super(context); this.setFocusable(true); this.setFocusableInTouchMode(true); holder = this.getHolder(); holder.addCallback(this); paint1 = new Paint(); paint1.setColor(Color.RED); paint2 = new Paint(); paint2.setColor(Color.GRAY); Bitmap bitmap1 = BitmapFactory.decodeStream(context.getResources() .openRawResource(R.drawable.ic_launcher)); bitmap = bitmap1.extractAlpha();// 获取一个透明图片 y = bitmap.getWidth();//初始化y轴坐标 }
解决方案:
<span style="font-size:18px;">public ProgressView(Context context,<span style="color:#ff0000;">AttributeSet attrs</span>) { super(context<span style="color:#ff0000;">,attrs</span>); this.setFocusable(true); this.setFocusableInTouchMode(true); holder = this.getHolder(); holder.addCallback(this); paint1 = new Paint(); paint1.setColor(Color.RED); paint2 = new Paint(); paint2.setColor(Color.GRAY); Bitmap bitmap1 = BitmapFactory.decodeStream(context.getResources() .openRawResource(R.drawable.ic_launcher)); bitmap = bitmap1.extractAlpha();// 获取一个透明图片 y = bitmap.getWidth();//初始化y轴坐标 }</span>
0 0
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface androi
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface androi
- 自定义View:Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context,
- 关于java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.Att
- 关于java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.Att
- java.lang.NoSuchMethodException: <init> [class android.content.Context, interface androidutil.Attri
- Caused by: java.lang.NoSuchMethodException: false [class android.view.View]
- Caused by: java.lang.NoSuchMethodException: xxx [class android.view.View]
- Android 自定义控件时出现: Caused by: java.lang.NoSuchMethodException
- Caused by: java.lang.NoSuchMethodException
- Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.
- Caused by: java.lang.NoSuchMethodException: callDrawGLFunction [long]
- Caused by: java.lang.NoSuchMethodException: com.you.entity.sys.Param.<init>()
- iOS 剪切板-(看了一点待研究)
- GCD线程使用
- WinForm中ListView研究及以一个以太网实时监视Demon
- IOS 四种保存数据的方式
- Python & R 学习
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- ZBarSDK–读取条形码信息
- 塑料脱标机的独特优势
- 625某电商网站数据库宕机故障解决实录(下)
- ios xcode如何修改应用的名称
- 实用代码4
- IOS---APNS 消息推送实践
- erlang 一些常用函数 缓慢填坑
- 心急的C小加(南阳oj236)(贪心)