When clicking on a button I need to open the front camera by default but back camera is displaying. Please give me some idea how to open front camera.
This is my code:
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
startActivityForResult(intent, 0);
}
}); Bitmap bmp;
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if ( data != null && data.getExtras() != null) {
bmp = (Bitmap) data.getExtras().get("data");
iv.setImageBitmap(bmp);
}
}