I am using FragmentStatePagerAdapter to show around 5 fragments in an activity.On each activity I am showing the images which I am fetching from FirebaseListAdapter/Firebase
I Found this way too
public class NoteAdapter extends FirestoreRecyclerAdapter {
Context context;
public NoteAdapter(@NonNull FirestoreRecyclerOptions options) {
super(options);
}
@Override
protected void onBindViewHolder(@NonNull NoteHolder holder, int position, @NonNull final Note model) {
context = holder.itemView.getContext();
holder.r_tv.setText(model.getTitle());
Glide.with(context).load(model.getImage()).into(holder.r_iv);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(context, CategoryProductActivity.class);
MainActivity.myCategory2 = model.getTitle();
MainActivity.myCategoryIcon2 = model.getImage();
context.startActivity(i);
}
});
}
@NonNull
@Override
public NoteHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_category,parent,false);
return new NoteHolder(v);
}
public static class NoteHolder extends RecyclerView.ViewHolder
{
TextView r_tv;
ImageView r_iv;
public NoteHolder(@NonNull View itemView) {
super(itemView);
r_tv = itemView.findViewById(R.id.r_tv);
r_iv = itemView.findViewById(R.id.r_iv);
}
}
}