Intent fails because of Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()

后端 未结 2 532
轻奢々
轻奢々 2021-01-28 02:30

What I have: I have a RecyclerView with images of bars, coffee shops. etc

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

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-28 02:56

    I think you forget to pass context from activity !

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

    Receive context in Adapter :-

    public AdapterDatos(Context context , ArrayList listalugares) {
            this.context = context;
            this.listalugares = listalugares;
        }
    

    I hope this help you!

提交回复
热议问题