Here we go.
I made a subclass of com.jme3.app.Application.
In the start() method, i wrote the following code:
context = new MyOGLESContext();
context.setSystemListener(this);
context.create(false);
Thus, I replace the context of the JME3 application with my own context.
My own implementation of the context looks like this:
public class MyOGLESContext extends OGLESContext {
public MyOGLESContext(){
super();
}
public GLSurfaceView createView(Activity activity){
view = new MyAndroidInput(activity);
view.setEGLContextClientVersion(2);
view.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
view.setFocusableInTouchMode(true);
view.setFocusable(true);
view.setRenderer(this);
view.getHolder().setFormat(PixelFormat.TRANSLUCENT);
return view;
}
}
Here is the class of MyAndroidInput:
public class MyAndroidInput extends AndroidInput {
public MyAndroidInput(Context ctx, AttributeSet attribs){
super(ctx, attribs);
}
public MyAndroidInput(Context ctx){
super(ctx);
}
@Override
public boolean onTouchEvent(MotionEvent e) {
((FooActivity)getContext()).reactTotouchEvent((int)e.getX(), (int)e.getY());
return super.onTouchEvent(e);
}
}
Please note that, in the end, I dropped JME3 for developing my mobile application as there were graphical artifacts when displaying animated 3D models. I cannot remember if these artifacts were introduced by using this context, though.
I wrote about this in my master thesis but I could not gather more information about Android JME3 application development.
There, the main focus was on using Augmented Reality running on Android devices.
Finally I used JPCT to write the application.
If you are interested in my findings about AR and Android have a look at http://www.koratien.at/blogentries/Massively_Multiplayer_Augmented_Reality_Games.htm
Best regards