can we call startActivityForResult from adapter?

后端 未结 4 704
无人共我
无人共我 2021-02-03 19:10

is it possible to have method onActivityResume within adapter & call startActivityForResult?

4条回答
  •  遇见更好的自我
    2021-02-03 19:54

    Yes. Just pass the context of the activity to the adapter in the adapter's constructor (here stored as mContext). In getView, just call

    ((Activity) mContext).startActivityForResult(intent,REQUEST_FOR_ACTIVITY_CODE);
    

提交回复
热议问题