Example usage for android.provider MediaStore ACTION_IMAGE_CAPTURE

List of usage examples for android.provider MediaStore ACTION_IMAGE_CAPTURE

Introduction

In this page you can find the example usage for android.provider MediaStore ACTION_IMAGE_CAPTURE.

Prototype

String ACTION_IMAGE_CAPTURE

To view the source code for android.provider MediaStore ACTION_IMAGE_CAPTURE.

Click Source Link

Document

Standard Intent action that can be sent to have the camera application capture an image and return it.

Usage

From source file:reportsas.com.formulapp.Formulario.java

public void CapturaF() {
    if (parametroCam == null) {

        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(intent, 1);

    } else {/*from   ww  w  .j  a v  a 2s . c om*/

        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.dialog_imagen);
        dialog.setTitle("Captura de Formulario");
        byte[] decodedByte = Base64.decode(parametroCam.getValor(), 0);

        ImageView imageview = (ImageView) dialog.findViewById(R.id.ImaVcaptura);
        Button Button1 = (Button) dialog.findViewById(R.id.NuevaToma);
        Button Button2 = (Button) dialog.findViewById(R.id.btn_cerrar);

        imageview.setImageBitmap(BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length));
        Button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                startActivityForResult(intent, 1);
                dialog.dismiss();
            }
        });

        Button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dialog.dismiss();
            }
        });

        dialog.show();

    }

}

From source file:br.com.bioscada.apps.biotracks.TrackDetailActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;//  w  w w .j a v a2 s  . co m
    switch (item.getItemId()) {
    case R.id.track_detail_insert_marker:
        AnalyticsUtils.sendPageViews(this, AnalyticsUtils.ACTION_INSERT_MARKER);
        intent = IntentUtils.newIntent(this, MarkerEditActivity.class)
                .putExtra(MarkerEditActivity.EXTRA_TRACK_ID, trackId);
        startActivity(intent);
        return true;
    case R.id.track_detail_insert_photo:
        if (!FileUtils.isExternalStorageWriteable()) {
            Toast.makeText(this, R.string.external_storage_not_writable, Toast.LENGTH_LONG).show();
            return false;
        }

        File dir = FileUtils.getPhotoDir(trackId);
        FileUtils.ensureDirectoryExists(dir);

        String fileName = SimpleDateFormat.getDateTimeInstance().format(new Date());
        File file = new File(dir, FileUtils.buildUniqueFileName(dir, fileName, JPEG_EXTENSION));

        photoUri = Uri.fromFile(file);
        intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
        startActivityForResult(intent, CAMERA_REQUEST_CODE);
        return true;
    case R.id.track_detail_play:
        playTracks(new long[] { trackId });
        return true;
    case R.id.track_detail_share:
        shareTrack(trackId);
        return true;
    case R.id.track_detail_markers:
        intent = IntentUtils.newIntent(this, MarkerListActivity.class)
                .putExtra(MarkerListActivity.EXTRA_TRACK_ID, trackId);
        startActivity(intent);
        return true;
    case R.id.track_detail_play_multiple:
        PlayMultipleDialogFragment.newInstance(trackId).show(getSupportFragmentManager(),
                PlayMultipleDialogFragment.PLAY_MULTIPLE_DIALOG_TAG);
        return true;
    case R.id.track_detail_export:
        Track track = myTracksProviderUtils.getTrack(trackId);
        boolean hideDrive = track != null ? track.isSharedWithMe() : true;
        ExportDialogFragment.newInstance(hideDrive).show(getSupportFragmentManager(),
                ExportDialogFragment.EXPORT_DIALOG_TAG);
        return true;
    case R.id.track_detail_edit:
        intent = IntentUtils.newIntent(this, TrackEditActivity.class).putExtra(TrackEditActivity.EXTRA_TRACK_ID,
                trackId);
        startActivity(intent);
        return true;
    case R.id.track_detail_delete:
        deleteTracks(new long[] { trackId });
        return true;
    case R.id.track_detail_sensor_state:
        intent = IntentUtils.newIntent(this, SensorStateActivity.class);
        startActivity(intent);
        return true;
    case R.id.track_detail_settings:
        intent = IntentUtils.newIntent(this, SettingsActivity.class);
        startActivity(intent);
        return true;
    case R.id.track_detail_help_feedback:
        intent = IntentUtils.newIntent(this, HelpActivity.class);
        startActivity(intent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:rpassmore.app.fillthathole.ViewHazardActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case ADD_PHOTO_DIALOG_ID:
        // Create our AlertDialog
        Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(//  w w w.ja v a  2  s.co  m
                "You can attach a photo of the hazard to your report. Would you like to take a new photo or use an existing one?")
                .setCancelable(true).setPositiveButton("New photo", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        String filename = System.currentTimeMillis() + ".jpg";
                        File imageDirectory = new File(
                                Environment.getExternalStorageDirectory() + "/FillThatHole", filename);
                        ContentValues values = new ContentValues();
                        values.put(Images.Media.MIME_TYPE, "image/jpeg");
                        values.put(Media.DESCRIPTION, "FillThatHole Image");
                        values.put(Media.DATA, imageDirectory.getPath());
                        values.put(MediaStore.Images.Media.TITLE, filename);

                        // start the camera and take a new photo
                        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                        capturedImageURI = getContentResolver()
                                .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

                        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageURI);
                        startActivityForResult(cameraIntent, PICTURE_ACTIVITY);
                    }
                }).setNegativeButton("Existing photo", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // select photo from gallery
                        Intent intent = new Intent(Intent.ACTION_PICK,
                                android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                        startActivityForResult(intent, PICK_PHOTO_ACTIVITY);
                    }
                });
        AlertDialog dialog = builder.create();
        dialog.show();
        return dialog;

    }
    return super.onCreateDialog(id);
}

From source file:com.facebook.react.views.webview.ReactWebViewManager.java

@Override
protected WebView createViewInstance(final ThemedReactContext reactContext) {
    final ReactWebView webView = new ReactWebView(reactContext);

    /**//w w w .  j a  v a2s.c o  m
     * cookie?
     * 5.0???cookie,5.0?false
     * 
     */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
    }

    webView.setDownloadListener(new DownloadListener() {
        @Override
        public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype,
                long contentLength) {
            Uri uri = Uri.parse(url);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            reactContext.getCurrentActivity().startActivity(intent);

            //                DownloadManager.Request request = new DownloadManager.Request(
            //                        Uri.parse(url));
            //
            //                request.setMimeType(mimetype);
            //                String cookies = CookieManager.getInstance().getCookie(url);
            //                request.addRequestHeader("cookie", cookies);
            //                request.addRequestHeader("User-Agent", userAgent);
            //                request.allowScanningByMediaScanner();
            ////                request.setTitle()
            //                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
            //                request.setDestinationInExternalPublicDir(
            //                        Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(
            //                                url, contentDisposition, mimetype));
            //                DownloadManager dm = (DownloadManager) reactContext.getCurrentActivity().getSystemService(DOWNLOAD_SERVICE);
            //                dm.enqueue(request);
            //                Toast.makeText(reactContext, "...", //To notify the Client that the file is being downloaded
            //                        Toast.LENGTH_LONG).show();

        }
    });
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public boolean onConsoleMessage(ConsoleMessage message) {
            if (ReactBuildConfig.DEBUG) {
                return super.onConsoleMessage(message);
            }
            // Ignore console logs in non debug builds.
            return true;
        }

        @Override
        public void onGeolocationPermissionsShowPrompt(String origin,
                GeolocationPermissions.Callback callback) {
            callback.invoke(origin, true, false);
        }

        private File createImageFile() throws IOException {
            // Create an image file name
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            String imageFileName = "JPEG_" + timeStamp + "_";
            File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
            File imageFile = new File(storageDir, /* directory */
                    imageFileName + ".jpg" /* filename */
            );
            return imageFile;
        }

        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                WebChromeClient.FileChooserParams fileChooserParams) {
            if (mFilePathCallback != null) {
                mFilePathCallback.onReceiveValue(null);
            }
            mFilePathCallback = filePathCallback;

            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent
                    .resolveActivity(reactContext.getCurrentActivity().getPackageManager()) != null) {
                // Create the File where the photo should go
                File photoFile = null;
                try {
                    photoFile = createImageFile();
                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
                } catch (IOException ex) {
                    // Error occurred while creating the File
                    FLog.e(ReactConstants.TAG, "Unable to create Image File", ex);
                }

                // Continue only if the File was successfully created
                if (photoFile != null) {
                    mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
                    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                } else {
                    takePictureIntent = null;
                }
            }

            Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
            contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
            contentSelectionIntent.setType("*/*");

            Intent[] intentArray;
            if (takePictureIntent != null) {
                intentArray = new Intent[] { takePictureIntent };
            } else {
                intentArray = new Intent[0];
            }

            Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
            chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
            chooserIntent.putExtra(Intent.EXTRA_TITLE, "?");
            chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
            reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            // final Intent galleryIntent = new Intent(Intent.ACTION_PICK);
            // galleryIntent.setType("image/*");
            // final Intent chooserIntent = Intent.createChooser(galleryIntent, "Choose File");
            // reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            return true;
        }

        @Override
        public void onShowCustomView(View view, CustomViewCallback callback) {

            if (mVideoView != null) {
                callback.onCustomViewHidden();
                return;
            }

            // Store the view and it's callback for later, so we can dispose of them correctly
            mVideoView = view;
            mCustomViewCallback = callback;

            view.setBackgroundColor(Color.BLACK);
            getRootView().addView(view, FULLSCREEN_LAYOUT_PARAMS);
            webView.setVisibility(View.GONE);

            UiThreadUtil.runOnUiThread(new Runnable() {
                @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                @Override
                public void run() {
                    // If the status bar is translucent hook into the window insets calculations
                    // and consume all the top insets so no padding will be added under the status bar.
                    View decorView = reactContext.getCurrentActivity().getWindow().getDecorView();
                    decorView.setOnApplyWindowInsetsListener(null);
                    ViewCompat.requestApplyInsets(decorView);
                }
            });

            reactContext.getCurrentActivity()
                    .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        }

        @Override
        public void onHideCustomView() {
            if (mVideoView == null) {
                return;
            }

            mVideoView.setVisibility(View.GONE);
            getRootView().removeView(mVideoView);
            mVideoView = null;
            mCustomViewCallback.onCustomViewHidden();
            webView.setVisibility(View.VISIBLE);
            //                View decorView = reactContext.getCurrentActivity().getWindow().getDecorView();
            //                // Show Status Bar.
            //                int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
            //                decorView.setSystemUiVisibility(uiOptions);

            UiThreadUtil.runOnUiThread(new Runnable() {
                @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                @Override
                public void run() {
                    // If the status bar is translucent hook into the window insets calculations
                    // and consume all the top insets so no padding will be added under the status bar.
                    View decorView = reactContext.getCurrentActivity().getWindow().getDecorView();
                    //                                decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
                    //                                    @Override
                    //                                    public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
                    //                                        WindowInsets defaultInsets = v.onApplyWindowInsets(insets);
                    //                                        return defaultInsets.replaceSystemWindowInsets(
                    //                                                defaultInsets.getSystemWindowInsetLeft(),
                    //                                                0,
                    //                                                defaultInsets.getSystemWindowInsetRight(),
                    //                                                defaultInsets.getSystemWindowInsetBottom());
                    //                                    }
                    //                                });
                    decorView.setOnApplyWindowInsetsListener(null);
                    ViewCompat.requestApplyInsets(decorView);
                }
            });

            reactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        }

        private ViewGroup getRootView() {
            return ((ViewGroup) reactContext.getCurrentActivity().findViewById(android.R.id.content));
        }

    });

    reactContext.addLifecycleEventListener(webView);
    reactContext.addActivityEventListener(new ActivityEventListener() {
        @Override
        public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
            if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {
                return;
            }
            Uri[] results = null;

            // Check that the response is a good one
            if (resultCode == Activity.RESULT_OK) {
                if (data == null) {
                    // If there is not data, then we may have taken a photo
                    if (mCameraPhotoPath != null) {
                        results = new Uri[] { Uri.parse(mCameraPhotoPath) };
                    }
                } else {
                    String dataString = data.getDataString();
                    if (dataString != null) {
                        results = new Uri[] { Uri.parse(dataString) };
                    }
                }
            }

            if (results == null) {
                mFilePathCallback.onReceiveValue(new Uri[] {});
            } else {
                mFilePathCallback.onReceiveValue(results);
            }
            mFilePathCallback = null;
            return;
        }

        @Override
        public void onNewIntent(Intent intent) {
        }
    });
    mWebViewConfig.configWebView(webView);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setDisplayZoomControls(false);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDefaultFontSize(16);
    webView.getSettings().setTextZoom(100);
    // Fixes broken full-screen modals/galleries due to body height being 0.
    webView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }

    return webView;
}

From source file:ca.ualberta.cs.swapmyride.View.AddInventoryActivity.java

/**
 * This calls the activity to take the photo.
 *///from  w  w w  . java2s.co  m

private void dispatchTakePictureIntent() {

    // http://developer.android.com/training/permissions/requesting.html
    // Here, thisActivity is the current activity
    if (ContextCompat.checkSelfPermission(AddInventoryActivity.this,
            Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {

        // Should we show an explanation?
        if (ActivityCompat.shouldShowRequestPermissionRationale(AddInventoryActivity.this,
                Manifest.permission.CAMERA)) {

            // Show an explanation to the user *asynchronously* -- don't block
            // this thread waiting for the user's response! After the user
            // sees the explanation, try again to request the permission.

        } else {

            // No explanation needed, we can request the permission.

            ActivityCompat.requestPermissions(AddInventoryActivity.this,
                    new String[] { Manifest.permission.CAMERA }, MY_PERMISSIONS_REQUEST_CAMERA);

            // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
            // app-defined int constant. The callback method gets the
            // result of the request.
        }
    } else {

        Log.i("TakingPictureIntent", "Trying to take a photo");
        Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (takePictureIntent.resolveActivity(getPackageManager()) != null
                && checkHasCamera(getApplicationContext())) {

            startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
        }
    }
}

From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_client.ui.activity.ItemListActivity.java

public void takePicture() {
    mFileCaptureUri = Uri.fromFile(new File(FileUtils.getDir(),
            ConstantKeys.TEMP + String.valueOf(System.currentTimeMillis()) + ConstantKeys.EXTENSION_JPG));

    tempFilePath = mFileCaptureUri.getPath();

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    intent.putExtra(MediaStore.EXTRA_OUTPUT, mFileCaptureUri);

    try {//from   ww  w. j  a  va 2s  .  c o  m
        intent.putExtra(ConstantKeys.RETURNDATA, true);
        startActivityForResult(intent, PICK_FROM_CAMERA);
    } catch (ActivityNotFoundException e) {
        log.warn("Cannot launch any app to take picture", e);
    }
}

From source file:hku.fyp14017.blencode.ui.fragment.LookFragment.java

public void addLookFromCamera() {
    lookFromCameraUri = UtilCamera/*from www  .  j av a  2  s.com*/
            .getDefaultLookFromCameraUri(getString(hku.fyp14017.blencode.R.string.default_look_name));

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, lookFromCameraUri);

    Intent chooser = Intent.createChooser(intent,
            getString(hku.fyp14017.blencode.R.string.select_look_from_camera));
    startActivityForResult(chooser, LookController.REQUEST_TAKE_PICTURE);
}

From source file:es.upv.riromu.arbre.main.MainActivity.java

/******************************************/
public void captureImage(View view) {
    try {/* w w  w. j a  v a  2s.  co  m*/
        Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        // Ensure that there's a camera activity to handle the intent
        if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
            // Create the File where the photo should go
            File photoFile = null;
            try {
                photoFile = createImageFile();
                //
                image_uri = Uri.fromFile(photoFile);
            } catch (IOException ex) {
                // Error occurred while creating the File
                Log.i(TAG, "Error");
            }
            // Continue only if the File was successfully created
            if (photoFile != null) {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri);
                takePictureIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,
                        getResources().getConfiguration().orientation);
                //    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,uriSavedImage);
                startActivityForResult(takePictureIntent, CAPTURE_IMAGE);
            }
        }
    } catch (Exception e) {
        Log.e(TAG, "Error" + e.getMessage());
    }
}

From source file:com.grass.caishi.cc.activity.AdAddActivity.java

/**
 * ?/*from w  ww  .  j ava 2s.  c o  m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", Toast.LENGTH_SHORT).show();
        return;
    }

    // cameraFile = new File(PathUtil.getInstance().getImagePath(),
    // DemoApplication.getInstance().getUserName()
    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            MyApplication.getInstance().getUser() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:com.example.innf.newchangtu.Map.view.activity.MainActivity.java

private void initFAB() {

    mFloatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.floating_actions_menu);

    /**//*from  w w w . ja v a  2  s .com*/
    mActionExchangeMap = (FloatingActionButton) findViewById(R.id.action_exchange_map);
    mActionExchangeMap.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mBaiduMap.getMapType() == BaiduMap.MAP_TYPE_NORMAL) {
                mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
                mActionExchangeMap.setTitle(getResources().getString(R.string.fab_exchange_map_normal));
            } else {
                mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
                mActionExchangeMap.setTitle(getResources().getString(R.string.fab_exchange_map_site));
            }
            mFloatingActionsMenu.toggle();
        }
    });

    /*?*/
    mActionExchangeModel = (FloatingActionButton) findViewById(R.id.action_exchange_model);
    mActionExchangeModel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mLocationMode == MyLocationConfiguration.LocationMode.NORMAL) {
                mLocationMode = MyLocationConfiguration.LocationMode.COMPASS;
                mActionExchangeModel.setTitle(getResources().getString(R.string.fab_exchange_model_common));
            } else {
                mLocationMode = MyLocationConfiguration.LocationMode.NORMAL;
                mActionExchangeModel.setTitle(getResources().getString(R.string.fab_exchange_model_compass));
            }
            mFloatingActionsMenu.toggle();
        }
    });

    /**/
    mActionFastBroadcast = (FloatingActionButton) findViewById(R.id.action_fast_broadcast);
    mActionFastBroadcast.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            fastSend();
            mFloatingActionsMenu.toggle();
        }
    });

    /*??*/
    mActionPhotoRecord = (FloatingActionButton) findViewById(R.id.action_fab_recognizes_license_plate);
    mActionPhotoRecord.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (null == mTrack) {
                Snackbar.make(view, "?", Snackbar.LENGTH_LONG).show();
            } else {
                if (isSdcardExisting()) {
                    Intent captureImageIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                    captureImageIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTrackPhotoUri(mTrack));
                    startActivityForResult(captureImageIntent, REQUEST_TRACK_PHOTO);
                } else {
                    Snackbar.make(view, "?SD?", Snackbar.LENGTH_LONG).show();
                }
            }
            mFloatingActionsMenu.toggle();
        }
    });

    /*?????*/
    mActionFastLocal = (FloatingActionButton) findViewById(R.id.action_fast_local);
    mActionFastLocal.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            /*??*/
            centerToMyLocation();
            if (null == mTrack) {
                mTrack = new Track();
                Position position = new Position();
                position.setPosition(getStatus());
                position.setMessage("");
                mPositionList.add(position);
                mTrack.setStartPosition(getStatus());
                mTrack.setPositionList(mPositionList);
                isPositionEmpty(mPositionList);
                updateUI();
            } else {
                addPosition();
            }
            mFloatingActionsMenu.toggle();
        }
    });
}