Inside a native interface, can I return as PeerComponent a View declared in an Activity that is not the main Activity used by Codename One? In other words, can I use a custom Activity?
My issue is that I have to use an Activity that implements an interface provided by the SDK that I’m trying to use.
Could you show me an example? Thank you
While that might be possible with some Android backflips I have a better idea that would also solve a lot of other similar use cases. Albeit this is a bit of a sledgehammer solution so it might be problematic in some cases.
For next weeks release we'll add the build hint: android.customActivity
where you can define the full class name of your custom activity subclass. Your activity must derive from com.codename1.impl.android.CodenameOneActivity
and the stub class will derive from that activity. This way you can implement and override any method you desire within the activity class.
The case where this would be a problem would be when two cn1libs choose to use this approach. Obviously only one can "win" so this isn't ideal. But this is a rare enough case that it shouldn't matter.