Home Open Camera Button is saved in the final png screenshot
Reply: 0

Open Camera Button is saved in the final png screenshot

user1934 Published in April 22, 2018, 6:49 am

I created an app to take photos using mobile's camera, show GPS coordinates as a text, and save the image to mobile's gallery. The problem is that the final screenshot saved in mobile's picture gallery contains the "Open Camera" BUTTON. How can I remove it from the screenshot (png) saved?

This is my code:

       /* capture image */

         private void captureImage() {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    File photoFile = null;
    try {
        photoFile = createImageFile();
    catch (IOException e) {
    //fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
    String authorities = getApplicationContext().getPackageName() + ".provider";
    Uri imageUri = FileProvider.getUriForFile(this, authorities, photoFile);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);

    // start the image capture Intent
    startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);


/* create image file to store photo */
  String mCurrentPhotoPath;
   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 = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
    File image = File.createTempFile(
            imageFileName,  /* prefix */
            ".jpg",         /* suffix */
            storageDir      /* directory */
    );         // Save a file: path for use with ACTION_VIEW intents
    mCurrentPhotoPath = image.getAbsolutePath();
    return image;

Where to add the openCameraButton.setVisibility(View.GONE); and openCameraButton.setVisibility(View.VISIBLE); ? Is there any way to NOT store my image to the mobile's default pictures directory after taking photo ?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308254 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO