Privatevoidshowcameraaction () {
if (Contextcompat.checkselfpermission (GetContext (), Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= packagemanager.permission_granted) {
Requestpermission (Manifest.permission.WRITE_EXTERNAL_STORAGE,
GetString (R.string.mis_permission_rationale_write_storage),
Request_storage_write_access_permission);
Intent Intent =newintent (mediastore.action_image_capture);
if (Intent.resolveactivity (Getactivity (). Getpackagemanager ())!=null) {
Mtmpfile = Fileutils.createtmpfile (Getactivity ());
if (Mtmpfile!=null&& mtmpfile.exists ()) {
/* Get the current system's Android version number * *
Intcurrentapiversion = Android.os.Build.VERSION.SDK_INT;
LOG.E ("Currentapiversion", "currentapiversion====>" +currentapiversion);
if (currentapiversion<24) {
Intent.putextra (Mediastore.extra_output, Uri.fromfile (mtmpfile));
Startactivityforresult (Intent, Request_camera);
Contentvalues contentvalues =newcontentvalues (1);
Contentvalues.put (MediaStore.Images.Media.DATA, Mtmpfile.getabsolutepath ());
Uri uri = GetContext (). Getcontentresolver (). Insert (mediastore.images.media.external_content_uri,contentvalues);
Intent.putextra (Mediastore.extra_output, URI);
Startactivityforresult (Intent, Request_camera);
Toast.maketext (Getactivity (), R.string.mis_error_image_not_exist, Toast.length_short). Show ();
Toast.maketext (Getactivity (), R.string.mis_msg_no_camera, Toast.length_short). Show ();