Code example for Thread

Methods: start

0
 
    /* See: SurfaceHolder.Callback */ 
    public void surfaceCreated(SurfaceHolder holder) {
 
        Log.i("APP:", "Surface for native GL code created");
        mAppThread = new Thread(new AppRunnable());
        mSurface = holder.getSurface();
 
        /* Write a message on the new surface */ 
        Canvas canvas = holder.lockCanvas();
        Paint p = new Paint();
        p.setStyle(Paint.Style.FILL);
        p.setColor(Color.GREEN);
        p.setTextSize(40);
        p.setAntiAlias(true);
        canvas.drawText("V4L2-GFX needs a data stream, waiting", 75, 75, p);
        holder.unlockCanvasAndPost(canvas);
 
        /* 
         * Note: we must start the GL render thread before launching a video with MediaPlayer. 
         * This is because a tweaked version of libstagefrighthw.so knows how to 
         * render to texture buffers when an application opens the V4L2-GFX driver first 
         * (as a video consumer) rather than routing to overlays. 
         */ 
        mAppThread.start();
 
        if (mLaunchVideo && (mFilename != null)) {
            mMediaPlayer = new MediaPlayer();
            launchVideo(holder);
        }