您当前的位置: 首页 >  Java

ZhangJiQun&MXP

暂无认证

  • 0浏览

    0关注

    1187博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

IntentService 空构造函数,InstantiationException(实例化异常),java NIO

ZhangJiQun&MXP 发布时间:2020-04-28 17:42:16 ,浏览量:0

IntentService 是继承自 Service 并处理异步请求的一个类,在 IntentService 内有一个工作线程来处理耗时操作,当任务执行完后,IntentService 会自动停止,不需要我们去手动结束。如果在短时间内(Service没有自动调用stopService)启动 IntentService 多次,那么每一个耗时操作会以工作队列的方式在 IntentService 的 onHandleIntent 回调方法中执行,依次去执行,执行完自动结束。  

报错:                   Caused by: java.lang.InstantiationException: TestIntentServer has no zero argument constructor

原因就是由于构造函数问题有参数解决:

 IntentService 的构造函数 string 什么用:

* @param name Used to name the worker thread, important only for debugging.
关注
打赏
1665659684
查看更多评论
立即登录/注册

微信扫码登录

0.0421s