You could use this library to achieve the results.
Material Camera
Sample Code for using this lib after integrating the lib,
public class MainActivity extends AppCompatActivity {
private final static int CAMERA_RQ = 6969;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new MaterialCamera(this)
.start(CAMERA_RQ);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Received recording or error from MaterialCamera
if (requestCode == CAMERA_RQ) {
if (resultCode == RESULT_OK) {
Toast.makeText(this, "Saved to: " + data.getDataString(), Toast.LENGTH_LONG).show();
} else if(data != null) {
Exception e = (Exception) data.getSerializableExtra(MaterialCamera.ERROR_EXTRA);
e.printStackTrace();
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
}
3
solved I want to record video through camera Android [closed]