to display the images on the Imageview from an url I use this code, but without success :
class Article(var id:Int,var nom:String,var lienimg:String, var ifram:String){
}
class ArticleAdapter (var articles:ArrayList<Article>) : RecyclerView.Adapter<ArticleAdapter.MyViewHolder>(){
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
var vue=LayoutInflater.from(parent.context).inflate(R.layout.listeviss, parent, false)
return MyViewHolder(vue)
}
override fun getItemCount(): Int {
return articles.size
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
var article = articles.get(position)
holder.nomvisite.setText(article.nom)
holder.lieimgvisite.setText(article.lienimg)
holder.ifram.setText(article.ifram)
var urldelimg:String = "linkmysite.com/image.jpg"
Glide.with(this).load(urldelimg).into(holder.imagedubloc)
}
class MyViewHolder(var vue:View):RecyclerView.ViewHolder(vue){
var nomvisite=vue.findViewById<TextView>(R.id.nom_visitevirtuelle)
var lieimgvisite=vue.findViewById<TextView>(R.id.lienimg)
var ifram=vue.findViewById<TextView>(R.id.ifram)
var imagedubloc=vue.findViewById<ImageView>(R.id.imagedubloc)
}
i have this error :
None of the following functions can be called with the arguments supplied:
public open fun with(p0: Activity): RequestManager defined in com.bumptech.glide.Glide
public open fun with(p0: android.app.Fragment): RequestManager defined in com.bumptech.glide.Glide
public open fun with(p0: Context): RequestManager defined in com.bumptech.glide.Glide
public open fun with(p0: View): RequestManager defined in com.bumptech.glide.Glide
public open fun with(p0: androidx.fragment.app.Fragment): RequestManager defined in com.bumptech.glide.Glide
public open fun with(p0: FragmentActivity): RequestManager defined in com.bumptech.glide.Glide
How can I fix this and display the image without error ? Thank You