小编EDP*_*ore的帖子

Android相机 - 应用程序传递NULL表面

每当我运行cam_thread时,我都会收到错误"app pass NULL surface".这个代码据说可以在HTC Incredible 1上运行.我已经稍微重新配置它以在机器人x上运行.但是我仍然遇到这个错误.

public class Android_Activity extends Activity 
{       
    Main_thread simulator;
    ToggleButton togglebutton;
    EditText ip_text;
    SensorManager sm = null;
    SurfaceView view;
    Sensors_thread the_sensors=null;
    String IP_address;
    Android_Activity the_app;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {       
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        view = new SurfaceView(this);       
        sm = (SensorManager) getSystemService(SENSOR_SERVICE);
        ip_text = (EditText) findViewById(R.id.IP_edit_txt);
        togglebutton = (ToggleButton) findViewById(R.id.CameraButton);
        togglebutton.setOnClickListener(new btn_listener());        
        the_app = this;
    }

    @Override
    protected void onResume() 
    {
        super.onResume();
    }

    protected void onStop()
    {
        super.onStop();
        simulator.stop_simu();
        this.finish();
    }

    private class btn_listener implements OnClickListener …
Run Code Online (Sandbox Code Playgroud)

camera android robot surfaceview surfaceholder

12
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

camera ×1

robot ×1

surfaceholder ×1

surfaceview ×1