Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between OneTimeWorkRequest.Builder and OneTimeWorkRequestBuilder?

Tags:

android

kotlin

I am going through the Google Codelabs Android basics for Kotlin WorkManager. I've seen the code written one way, then later on see it a different way, and was wondering if there was a difference at all between these?

// Add WorkRequest to save the image to the filesystem
val save = OneTimeWorkRequest.Builder(SaveImageToFileWorker::class.java).build()
// Add WorkRequest to save the image to the filesystem
val save = OneTimeWorkRequestBuilder<SaveImageToFileWorker>()
        .build()

Do these do the same thing?

like image 329
Brian Avatar asked Apr 15 '26 22:04

Brian


1 Answers

OneTimeWorkRequestBuilder<T>() is just a function that creates and returns an object of type OneTimeWorkRequest.Builder and there are no differences between them. You can check the OneTimeWorkRequestBuilder function signuature here.

like image 51
amir215909 Avatar answered Apr 18 '26 11:04

amir215909



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!