局外人123
局外人123
  • 发布:2023-07-20 21:35
  • 更新:2023-07-20 21:35
  • 阅读:263

uts里怎样写类的class对象

分类:uts
let uploadWorkRequest: WorkRequest = new OneTimeWorkRequest.Builder(DelayWorker.class)  
                        .setInitialDelay(10, TimeUnit.MINUTES)  
                        .build();

这里面class是一个DelayWorker的父类的对象,不是DelayWorker的对象,而且DelayWorker对象参数太多,根本不可能用DelayWorker().javaClass传,有什么办法传入类的class对象吗?

//这是转换的kt代码  
val uploadWorkRequest: WorkRequest = OneTimeWorkRequest.Builder(UploadWorker::class.java)  
                .setInitialDelay(10, TimeUnit.MINUTES)  
                .build()
2023-07-20 21:35 负责人:无 分享
已邀请:

要回复问题请先登录注册