我有一个 recyclerview 显示电影列表,我希望当单击的项目电影时可以使用 Parcelable 将数据传递给详细信息
这是我的 viewHolderAdapter
public class MovieVHolder extends RecyclerView.ViewHolder {
TextView mTxtTitleMovie, mTxtDescriptionMovie, mTxtDateMovie;
ImageView mImgPosterMovie;
public MovieVHolder(@NonNull final View itemView) {
super(itemView);
mTxtTitleMovie = itemView.findViewById(R.id.txt_title_movie);
mTxtDescriptionMovie = itemView.findViewById(R.id.txt_desc_movie);
mTxtDateMovie = itemView.findViewById(R.id.txt_date_movie);
mImgPosterMovie = itemView.findViewById(R.id.img_movie);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(context, DetailActivity.class);
context.startActivity(i);
}
});
}
public void bind(ListMovieEntity listMovieEntity) {
mTxtTitleMovie.setText(listMovieEntity.getMovieTittle());
mTxtDescriptionMovie.setText(listMovieEntity.getMovieDescription());
mTxtDateMovie.setText(listMovieEntity.getMovieDate());
Glide.with(context)
.load("https://image.tmdb.org/t/p/w185/"+listMovieEntity.getMoviePosterPath())
.into(mImgPosterMovie);
}
}
我在模型类中添加了 Parcelable
天涯尽头无女友
扬帆大鱼
相关分类