自定义组件,重写如下方法:
public cView(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs!=null) {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.attr);
a.recycle();
}在程序里直接调用正常没有问题,但发布成jar文件后,在其他程序里导入,在引用是,就提示异常后退出程序。有谁碰到过这个问题嘛?指教一下。多谢
public cView(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs!=null) {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.attr);
a.recycle();
}在程序里直接调用正常没有问题,但发布成jar文件后,在其他程序里导入,在引用是,就提示异常后退出程序。有谁碰到过这个问题嘛?指教一下。多谢
rejecting opcode 0x62 at 0x0017
rejected L .........
.........
threadid=3; thread exiting with uncaught exception
uncaught handler : thread main exiting due to uncaught exception.,,,
或者说:我自定义了一个组件属性通过 res/values下的 attrs.xml文件来定义的;
通过构造函数如下:
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.attr);
获取;打包成 jar文件后,在导入引用,在执行到上面的语句时就发生异常,
对R.styleable.attr引用出错,对应的属性文件 ,已经在新的工程里创建。那位大侠搞过,急盼! 多谢!
R.styleable.attr);
红色部分应该改成你所定义的组件..
R.styleable.attr); attr;已经是我定义的 属性的名字了。现在我看是,打包后的R.styleable.attr找的是原来的路径,在新工程里就找不到原来的路径了。现在怎么能在打包后的 类里 访问到 当前工程下 定义的 属性R.styleable.attr 。