@kenkyee I will admit that the serialization stuff is not quite comprehensive (and could do with further checking), but the proof of concept is there. It works through the continuation being serialized into a ByteArrayOutputStream, the bytearray backing it then being stored into a Parcellable (special casing serialization of various types to make it work correctly). To actually make handling the activityResult transparently what happens is that the code will create an invisible fragment that is added to the activity -
startActivtiyForResult
is called on this fragment - fragments will receive the events and are automatically saved with their arguments (the continuation is provided as such an argument with a Parcelable wrapper). There are various ways to break it - Don't capture View objects as I haven't special cased them - activities are sufficient.