I want to load a String out of a class to load it with picasso
val pic = String
Picasso.get().load(User1::profileImageUrl).into(pic)
but the "load" gets a red line underneath it and it doesnt work. here you can see my class
class User1(val uid: String, val username: String, val profileImageUrl: String)
so later I want to use that string with glide like this
Glide.with(applicationContext).load(personPhotoUrl)
.thumbnail(0.3f)
.apply(RequestOptions.circleCropTransform())
.into(profilepicture!!)
any Ideas?
I am not familiar with Picasso, but from javadoc load method takes String, Uri, File or resource id. You pass some kind of reflection reference on a property (if this construction makes sense at all).
If you want create pic one time you should use an instance of user:
val user : User1 = getUserSomewhere()
Picasso.get().load(user1.profileImageUrl).into(pic)
Or you can make a method:
fun loadUserProfileImage(user: User1, target: ImageView) {
Picasso.get().load(user1.profileImageUrl).into(target)
}
Also underneath red line tells you that there is an error and it has a message of what's wrong.)
Also this: val pic = String
is not correct, at least in your case. pic here is of type StringCompanionObject
.