How to add a button to switch between cameras
How can I add a button to camera-control opencv4android example? I have simply added in the main.xml file:
<button android:id="@+id/imgShoot" android:text="Capture" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right"/> and in OnCreate function, in MainActivity.java, after setContentView:
final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click } }); but it doesn't work. This button should be able to switch between front and back camera, in my device.