Log in or register to post comments

How to operate above the GLsurfaceView

November 4, 2010 - 6:32am #1

Hi
I have read the question that CliffWoo has asked.He wants to make a videoView on GLSurfaceView.And I need to make some Button and textView on above the VideoView,too. So I used the solution that answered for CliffWoo.
But when I want to do something else, I meet more question.
I want to change the text in textView above the GLsurfaceView, when detect the aim image. so I write like this:

    
//in the QCARSampleActivity.java                       
overlayView = View.inflate(QCARSampleActivity.this, R.layout.main, null);
                            addContentView(overlayView, new LayoutParams(
                                                        LayoutParams.FILL_PARENT,
                                                        LayoutParams.FILL_PARENT));
mButton = (Button) overlayView.findViewById(R.id.Button01);
overlayView.setVisibility(View.VISIBLE);
//here mButton is a public member

and in the ImageTargets.java, I do like these below in ImageTargetsRenderer.java

//in ImageTargetsRenderer.java
    private ImageTargets preTargets;
    public void onDrawFrame(GL10 gl){
        if (!mIsActive)
            return;

        // Call our native function to render content
            Log.d("ImageTargets","detected");
            mButton.setText("lol! I change the text in the button!!!");
        }
    }
    public ImageTargetsRenderer(ImageTargets imageTarget){
    	super();
    	preTargets = imageTarget;	
    }

in the ImageTargets.java , I have already changed the Methods of Construction

 
protected QCARSampleRenderer createRenderer()
    {
        return new ImageTargetsRenderer(this);
    }

But this time when I detected the aim image ,the programe closed , and the file named GLSurfaceView.class wil be open in Eclipse. And there is no error log in DDMS.
I need your help to solve the Problem. many thanks~!:)

Log in or register to post comments