I'm trying to just change the background color of a TextureView. I would expect this color to be viewed through a translucent camera view. For some reason this is not the case. If I completely remove the cameraโs preview from the onSurfaceTextureAvailable screen, the view remains white (or not visible). Any ideas? I am trying to get a TextureView window that sometimes contains a camera preview, and other times a plain color of my choice. Thanks.
import android.graphics.Color; import android.graphics.SurfaceTexture; import android.hardware.Camera; import android.media.MediaPlayer; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.Surface; import android.view.TextureView; import android.widget.FrameLayout; import android.widget.RelativeLayout; import java.io.IOException; public class MainActivity extends Activity { private TextureView mTextureView; FrameLayout screenFrame; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); screenFrame = (FrameLayout)findViewById(R.id.screenFrame); setVideoScreens(); } @Override public boolean onCreateOptionsMenu(Menu menu) {
source share