Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:42:39+00:00 2026-05-26T13:42:39+00:00

Alright I am making an Android app, and using the CAPTURE_PIC_REQUEST to take a

  • 0

Alright I am making an Android app, and using the CAPTURE_PIC_REQUEST to take a picture and store it as a preview on the screen in an imageviewer. I wanted to know how to get the Uri and actually path because I am planning on taking that information, saving it and accessing it later. So I can’t figure how to get the Uri or path name from that picture I just took. Here is the code from my activity that is handling

package com.CS480;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class AddEx extends Activity {
  static final int CAMERA_PIC_REQUEST = 1337; 
  public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add);

    Button camera = (Button) findViewById(R.id.picButton);
    camera.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);               
        }               
    });

}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == CAMERA_PIC_REQUEST) {  
        Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
        ImageView image = (ImageView) findViewById(R.id.returnedPic);  
        image.setImageBitmap(thumbnail);  
    }  
}

}

So how from that image that I am getting back on the app do I get the file location

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:42:39+00:00Added an answer on May 26, 2026 at 1:42 pm

    As far as I know, you can do something like this:

    private Uri mImageCaptureUri;
    
    public class AddEx extends Activity {
      static final int CAMERA_PIC_REQUEST = 1337; 
      public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add);
    
        Button camera = (Button) findViewById(R.id.picButton);
        camera.setOnClickListener(new View.OnClickListener() {
    
            public void onClick(View v) {
                Intent cameraIntent = 
                        new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
                        mImageCaptureUri);
                startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);               
            }               
        });
    
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == CAMERA_PIC_REQUEST) {  
            Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
            ImageView image = (ImageView) findViewById(R.id.returnedPic);  
            image.setImageBitmap(thumbnail);  
    
            String pathToImage = mImageCaptureUri.getPath();
    
            // pathToImage is a path you need. 
    
            // If image file is not in there, 
            //  you can save it yourself manually with this code:
            File file = new File(mImageCaptureUri.getPath());
            FileOutputStream fOut = new FileOutputStream(file);
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut); // You can choose any format you want
        }  
    }    
    

    From Android documentation about android.provider.MediaStore.EXTRA_OUTPUT:

    The name of the Intent-extra used to indicate a content resolver Uri
    to be used to store the requested image or video.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, here goes. I'm making a very basic app, and I want the user
Alright, very noob question. I'm making a CLI app that lets users design surveys.
Alright. So I figure it's about time I get into unit testing, since everyone's
Alright, I know how the fieldset / legend works out in HTML. Say you
Alright, I'm in the process of making a C# application that uses an API
Alright, here's my dillema. I am making a simple application with Qt Creator that
Alright, I'm taking an array, and making another array from it with the only
Possible Duplicate: Difference between void main and int main? Alright, so I'm using bloodshed
I am making a piece of code for DirectX app. It's meaning is to
Alright so im done doing pages with frames, and know i splitted up my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.