Since often in Android some functionality is directly implemented in an Activity (e.g. NativeActivity) I am now faced with the situation, that I have 2 Activities that I would like to be “merged” into one because I need both functionality.
So my initial idea would be to write a Proxy Activity, which delegates to internal Activity instances. Is something similar already possible in Android or might this concept even work?
Since often in Android some functionality is directly implemented in an Activity (e.g. NativeActivity)
Share
I tried implementing an Activity-Proxy which would delegate to other Activities (which would have to use the same
Window,WindowManager, etc.).Sadly, it does not work since the
Activity.attachmethods arefinal/packageand they are used for setting up all the internal variables. These variables are then used directly (without aprotectedorpublicgetter). So with no chance to mend the internals you cannot force all Activities to use the same context and thus you are forced to reimplement the functionality the Activities provide. 🙁