public class RecyclerAdapterClass extends RecyclerView.Adapter<RecyclerAdapterClass.MyViewHolder> {
List<String> headlineList=new ArrayList<>();
List<String> descriptionList=new ArrayList<>();
Context context;
int myPosition;
URL url;
public RecyclerAdapterClass(Context context, List<String> headlineList, List<String> descriptionList) {
this.context=context;
this.headlineList=headlineList;
this.descriptionList=descriptionList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater=LayoutInflater.from(context);
View view=inflater.inflate(R.layout.single_item,parent,false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
holder.rowHeadline.setText(headlineList.get(position));
holder.rowDescription.setText(descriptionList.get(position))
holder.singleRowLayout.setOnClickListener(v -> {
});
}
@Override
public int getItemCount() {
return headlineList.size();
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
TextView rowHeadline,rowDescription;
Linearlayout singleRowLayout;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
rowHeadline=itemView.findViewById(R.id.rowHeadline);
rowDescription=itemView.findViewById(R.id.rowDescription);
singleRowLayout=itemView.findViewById(R.id.singleItemLayout);
}
}
@SuppressLint("WrongThread")
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
}
}