Search code examples
androidadapter

can we call startActivityForResult from adapter?


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


Solution

  • 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);