The sample just uses the activity since it works top to bottom but I doubt you need that. My guess is that you can probably create your own class and instance and instead of using:
mSession.setSessionListener(this);
You can probably just use:
mSession.setSessionListener(myObject);
Where myObject would just be a class you create and place next to the regular native class that implements this interface.
Another point of interest is the onCreate
or other callbacks you might need. onCreate
can probably be mapped to our lifecycle methods thru a native interface but you can also use addLifecycleListener
which should work roughly like this:
com.codename1.impl.android.AndroidNativeUtil.addLifecycleListener(new LifecycleListener() {
public void onCreate(android.os.Bundle savedInstanceState) {
// ... on create code
}
public void onResume() {}
public void onPause() {}
public void onDestroy() {}
public void onSaveInstanceState(android.os.Bundle b) {}
public void onLowMemory() {}
});