sorry if this isn't the best board to ask this, but I thought it would be since my objective is to display the soft keyboard over a GLSurfaceView. Why does swapping a view (in my case, two GLSurfaceViews) prevent me from openning the software keyboard? Here is an example snippet (coded for Froyo):
Using java Syntax Highlighting
- package jvff.glsoftkey;
- import javax.microedition.khronos.egl.EGLConfig;
- import javax.microedition.khronos.opengles.GL10;
- import android.content.Context;
- import android.opengl.GLSurfaceView;
- import android.opengl.GLSurfaceView.Renderer;
- import android.util.AttributeSet;
- public class GLView extends GLSurfaceView implements Renderer {
- Context context;
- public GLView(Context context) {
- super(context);
- this.context = context;
- setRenderer(this);
- setFocusable(true);
- setFocusableInTouchMode(true);
- }
- public GLView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
- @Override
- public void onDrawFrame(GL10 gl) {
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
- }
- @Override
- public void onSurfaceChanged(GL10 arg0, int arg1, int arg2) {
- }
- @Override
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- gl.glClearColor(0.f, 0.f, 1.f, 1.f);
- }
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
Using java Syntax Highlighting
- package jvff.glsoftkey;
- import android.app.Activity;
- import android.content.Context;
- import android.os.Bundle;
- import android.view.MotionEvent;
- import android.view.Window;
- import android.view.WindowManager;
- import android.view.inputmethod.InputMethodManager;
- public class GLSoftKeyTest extends Activity {
- private GLView view;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- view = new GLView(this);
- setContentView(view);
- }
- @Override
- public void onBackPressed() {
- view = new GLView(this);
- setContentView(view);
- }
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0);
- return true;
- }
- return false;
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
When it opens initially, it works correctly. After pressing the back button (sorry for the non-intuitiveness of using the back key), it stops working. What am I missing to make it work? Thank you,
Janito

