0

Превью не выводиться на surface, сам surface создается но остается пустым.

public class MainActivity extends AppCompatActivity {
    Camera camera;
    SurfaceView preview;
    SurfaceHolder surfaceHolder;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        setContentView(R.layout.activity_main);
        preview = (SurfaceView) findViewById(R.id.surfaceView);
        surfaceHolder = preview.getHolder();
        try {
            camera.setPreviewDisplay(surfaceHolder);
        } catch (IOException e) {
            e.printStackTrace();
        }
        camera.startPreview();
    }
}
2
  • Пермишн есть соответствующий?
    – post_zeew
    15 апр 2017 в 19:58
  • @post_zeew , есть 16 апр 2017 в 10:50

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.