Let me try to synthesize what Alessandro Barreto told you.
Make your Anime class implement Serializable
public class Anime implements Serializable {
private String name;
private double rating;
// ...
public Anime() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
// ...
}
Leave the onCreateViewHolder like this:
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(mContext).inflate(R.layout.anime_row_item, parent, false);
MyViewHolder holder = new MyViewHolder(v);
return holder;
}
onBindViewHolder:
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
// Supondo que mData é uma lista de animes (List<Anime>)
Anime anime = mData.get(position);
holder.tv_name.setText(anime.getName());
holder.tv_rating.setText(anime.getRating());
holder.tv_studio.setText(anime.getStudio());
holder.tv_category.setText(anime.getCategorie());
// Load Image from the internet and set it into Imageview using Glide
// Edit: o que é option aqui?
Glide.with(mContext).load(anime.getImage_url()).apply(option).into(holder.img_thumbnail);
holder.itemView.setOnClickListener(v -> { // Java 8
Intent intent = new Intent(mContext, AnimeActivity.class);
intent.putExtra("extra_anime", anime);
mContext.startActivity(intent);
});
}
AnimeActivity # onCreate:
Intent intent = getIntent();
Anime anime = (Anime) intent.getSerializableExtra("extra_anime");
if (anime != null) {
Toast.makeText(this, anime.getName(), Toast.LENGTH_LONG).show();
} else {
// Toast.makeText(this, "Nenhum dado foi recebido", Toast.LENGTH_SHORT).show();
// finish();
}