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 4116676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:44:17+00:00 2026-05-20T22:44:17+00:00

start camera intent: void openCamera() { File imageDirectory = new File(/sdcard/myprog); if (!imageDirectory.isDirectory()) imageDirectory.mkdir();

  • 0

start camera intent:

void openCamera() {

   File imageDirectory = new File("/sdcard/myprog");
   if (!imageDirectory.isDirectory()) imageDirectory.mkdir();

   String path = imageDirectory.toString().toLowerCase();
   String name = imageDirectory.getName().toLowerCase();

  ContentValues values = new ContentValues(); 
  values.put(Media.TITLE, "Image"); 
  values.put(Images.Media.BUCKET_ID, path.hashCode());
  values.put(Images.Media.BUCKET_DISPLAY_NAME,name);

  values.put(Images.Media.MIME_TYPE, "image/jpeg");
  values.put(Media.DESCRIPTION, "Image capture by camera");
  values.put("_data", "/sdcard/myprog/1111.jpg");
    Uri uri = getContentResolver().insert( Media.EXTERNAL_CONTENT_URI , values);
  Intent i = new Intent("android.media.action.IMAGE_CAPTURE"); 

  i.putExtra(MediaStore.EXTRA_OUTPUT, uri);

  startActivityForResult(i, 0); 

}

and then…

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

     if (requestCode==0 && resultCode==RESULT_OK)    {

         Uri path = data.getData();
...

I tried many sample to take a picture with my camera on my program, and then use that picture with my program, but:

-i get an exception here: Uri path = data.getData();

-or i get a null value to: Uri path = data.getData();

what is the correct way, to get the shoted camera picture url?

Thanks, Leslie

  • 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-20T22:44:18+00:00Added an answer on May 20, 2026 at 10:44 pm

    you need to do

    Uri path = Uri.parse(imageDirectory.toString());
    

    at least if imageDirectory is holding a string representation of a Uri

    or i suppose you could just do this

    Uri imagePath = Uri.parse(path);
    

    since you are already getting the imagedirectory string

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

Sidebar

Related Questions

My application allows it's user to start a camera intent to take pictures to
I am using camera in my app. I am just using intent to start
Start a new Silverlight application... and in the code behind (in the Loaded event),
I start by creating a string variable with some non-ascii utf-8 encoded data on
In a MonoDroid app, the following code is used to start the native camera
I have an camera Activity like this: public void startCamera() { Log.d(ANDRO_CAMERA, Starting camera
I was looking at a tutorial, this one to be exact - http://android-er.blogspot.com/2011/01/start-camera-auto-focusing-autofocus.html And
I would like to start front camera of the iPad when app starts. How
I'm trying to take a picture from the Camera using intent with onActivityResult but
When the camera start to record my application throws this exception: E/MediaRecorder( 3316): setOutputFile

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.