super.onActivityResult inside adapter class? Android

前端 未结 2 796
無奈伤痛
無奈伤痛 2020-12-30 14:53

I have RecyclerView with very complex item, multiple buttons/images/texts. To access each button/image I set my click Listeners inside my Adapter class.

But now I a

2条回答
  •  醉酒成梦
    2020-12-30 15:29

    Another solution is to set onActivityResult method in activity class where you initiate your RecyclerView/ListView. That works too, except for some reason I got NPE errors when I tried to pass data using intents, so work-arround for that is create static String/Int and change it's value on clicks and access. That works just fine. But the answer above is also great, and it works just as fine, perhaps even better, performance wise.

提交回复
热议问题