HelloWorld
HelloWorld

Reputation: 2355

What should be written in the LifecycleListener methods in Codename One Android native implementation?

I am developping a mobile Codename One app (targeting Android for now, iOS then) that uses advanced camera features. Thus I need to use the native interface and implementation.

I am learning by doing that's why I am studying available CN1 demo source codes with native interface / implementation like the one about native GoogleMaps demo.

Looking at a typical Android activity code, the activity lifecycle methods are overridden and always start or end with a call to the superclass method (eg super.onCreate(), super.onPause(), super.onResume(), ...). In Android super refers to Activity class.

Why is the @Override not present above lifecycle methods in Codename One Android native implementation using the LifecycleListener and what is the corresponding way to call super.onXXX() in Codename One Android native implementation using the LifecycleListener ? But actually do I have to make that call to the super method at all or is it automatically called by CN1?

Explanations are welcome!

Upvotes: 1

Views: 129

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

The actual Codename One implementation already has an Activity which does all of those things. The lifecycle listener allows you to inject into that activity and write code as if it is there but you need to assume that the super calls happened as expected.

This is the actual activity, notice the calls to AndroidNativeUtil which map to the lifecycle listener calls.

Upvotes: 1

Related Questions