define such a variable
protected static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 0;
Use the code to call the camera from Android.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); imageUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),"fname_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
and in the class calling it, override the onActivityResult function and enter the code below.
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
source share