java.lang.InstantiationException: class has no zero argument constructor

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pbm863521/article/details/78972331
java.lang.InstantiationException: class has no zero argument constructor

需要在一个方法中的for循环中获取图片处理进度,在Fragment中显示。在该方法的for循环中采用发送广播的方法,在Fragment中接收进度数据进行显示。在Fragment类中声明了广播内部类。但是运行时出现上面问题。

解决方法如下:

1,如果是静态广播注册方式,广播作为内部类来使用:广播内部类声明为static类型。

2,如果是非静态广播注册方式:广播必须在类中注册(调用registerReceiver()方法)、注销(调用unregisterReceiver()方法)。

猜你喜欢

转载自blog.csdn.net/pbm863521/article/details/78972331
今日推荐