RecyclerView with ImageView and differents Activities

后端 未结 1 809
眼角桃花
眼角桃花 2021-01-27 12:11

What I have: A RecyclerView with pictures of places like bars, cofee stores, etc.

What I want: That when you click on one of these images I show you the info of the sele

相关标签:
1条回答
  • 2021-01-27 12:36

    Inside foodAndGo activity change,

    AdapterDatos adapter = new AdapterDatos(listalugares); to AdapterDatos adapter = new AdapterDatos(listalugares,foodAndGo.this);

    and inside adapter class add this

    private Context context;
    public AdapterDatos(ArrayList<ClaseNueva> listaLugares,Context context) {
    this.context=context;
    listalugares = listaLugares;
    }
    

    Now, you can call startactivity in adapter's onBindViewHolder like this

    Intent myIntent = new Intent(context, MapsActivity.class);
    context.startActivity(myIntent);
    
    0 讨论(0)
提交回复
热议问题