my variable passed into my class constructor can be either Fragment or AppCompactActivity, so I use the following code to check wther it's valid in Glide's .with function.
class XXXX(private val parent: Any)
if (parent is AppCompatActivity || parent is Fragment) {
// Load User Avatar
Glide.with(parent)
.load(dataSet[position].user.avatar)
.into(viewHolder.userAvatar)
}
when I only use parent is AppCompactActivity or parent is Fragement, the code works just fine. However, when I use an or operator, it gives me the following errors:
None of the following functions can be called with the arguments supplied.
with(Activity) defined in com.bumptech.glide.Glide
with(android.app.Fragment) defined in com.bumptech.glide.Glide
with(Context) defined in com.bumptech.glide.Glide
with(View) defined in com.bumptech.glide.Glide
with(androidx.fragment.app.Fragment) defined in com.bumptech.glide.Glide
with(FragmentActivity) defined in com.bumptech.glide.Glide