Revision: 80873
                            
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                    
                        at April 5, 2020 16:21 by m3000
                            
                            Initial Title
Adapter class for Recyclerview in kotlin android
Initial Description
This the base code for creating adapter class which is used for filling recyclerview in android. This snippet is written in kotlin but it is same to the java version
Initial Code
class ClassName(val list:ArrayList<Type of your list>):RecyclerView.Adapter<ClassName.ViewHolder>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ClassName.ViewHolder {
        val v = LayoutInflater.from(parent.context).inflate(R.layout.item_layout, parent, false)
        return ViewHolder(v)
    }
    override fun getItemCount(): Int {
       return list.size
    }
    override fun onBindViewHolder(holder: ClassName.ViewHolder, position: Int) {
        holder.bindItems(list[position])
    }
    class ViewHolder(itemview: View):RecyclerView.ViewHolder(itemview)
    {
        
        fun bindItems(t: type of your list){
            
        }
    }
}
                                Initial Tags
android
Initial Language
Other
Initial URL