我的原始文件夹中有一些 mp4 视频,现在我想在用户单击某个项目时使用 Intent.put 从活动 A 到活动 B 将这些视频传递给我的视频视图。
这是我的适配器类:
public class absadapter extends RecyclerView.Adapter<absadapter.exViewHolder> {
List<abs.Ex> exList;
Context context;
String ex1 = "android.resource://" + context.getPackageName() + "/" + R.raw.ex1;
absadapter(List exList,Context ctx) {
this.exList= exList;
context=ctx;
}
public static class exViewHolder extends RecyclerView.ViewHolder{
CardView cardView;
TextView exname;
ImageView exlogo;
exViewHolder(View itemView){
super(itemView);
cardView= itemView.findViewById(R.id.cardView);
exname= itemView.findViewById(R.id.ex_name);
exlogo=itemView.findViewById(R.id.exlogo);
}
}
@Override
public absadapter.exViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
View viewthigh= LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_abslayout,parent,false);
absadapter.exViewHolder evh=new absadapter.exViewHolder(viewthigh);
return evh;
}
@Override
public void onBindViewHolder(final absadapter.exViewHolder holder, final int position){
holder.exname.setText(exList.get(position).name);
holder.exlogo.setImageResource(exList.get(position).logoId);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (position == 0 ){
Intent i1=new Intent(context,abdetails.class);
i1.putExtra("text",R.string.crunches);
context.startActivity(i1);
}
if (position == 1) {
Intent i1=new Intent(context,abdetails.class);
i1.putExtra("img",R.raw.ex1);
i1.putExtra("text",R.string.declinecrunch);
context.startActivity(i1);
}
if (position == 2) {
Intent i1=new Intent(context,abdetails.class);
i1.putExtra("text",R.string.dumsidebend);
context.startActivity(i1);
}
30秒到达战场
qq_笑_17
相关分类