Use startActivityForResult from non-activity

I don’t know if this is good practice or not, but casting a Context object to an Activity object compiles fine.

Try this:

if (mContext instanceof Activity) {
        ((Activity) mContext).startActivityForResult(...);
} else {
        Log.e("mContext should be an instanceof Activity.");
} 

This should compile, and the results should be delivered to the actual activity holding the context.

Leave a Comment