I created custom compound view where I incorporate functionality to take pictures.
I’m calling it like this (from view):
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
((Activity)mContext).startActivityForResult(intent, index);
This part works good. What I don’t know how to do is how do I implement onActivityResult inside my custom view?
Or should I catch this inside Activity and than re-route into my view? Doesn’t look like very nice solution..
There is no way to catch
onActivityResultfrom your view, only fromActivity.And its not safe to assume that’s
Contextobject isActivity. In general you should not rely on this fact. Even if it seems reasonable in case with views, you still should use only methods available troughContextinterface. That’s because your can’t predict all side-effects on theActivity, when you’re callingActivityspecific functions.