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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:46:08+00:00 2026-06-12T20:46:08+00:00

I have an app that’s fully working. It just has 1 problem with my

  • 0

I have an app that’s fully working. It just has 1 problem with my Camera Intent or permissions.

The app is supposed to launch the Camera Activity when the user presses a button. That’s working fine, but when the user accepts a picture by clicking the OK button on the camera, it doesn’t come back to my app. If they press the cancel button on the camera, it comes back to my app as expected.

I have read all the similar questions I can find on here, but none of them have fixed my problem. I need to tell the camera exactly where to save the image because I want to alternate between 2 in my app. Here’s the code that creates the Camera Intent and starts it:

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.parse(imagePath));
startActivityForResult(intent, 11);

I have tried multiple values for imagePath (which is a String), but the camera’s OK button has not worked with any of them. These are the paths I’ve tried:

/mnt/sdcard/<appName>/cameraImages/image1.jpg
from Environment.getExternalStorageDirectory()

/mnt/sdcard/Android/data/<appPkg>/cache/<appName>/cameraImages/image1.jpg
from context.getExternalCacheDir()

/mnt/sdcard/Android/data/<appPkg>/cache/<appName>/cameraImages/image1.jpg
from context.getCacheDir()

I have the following permissions in my manifest file:

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Can you guys help me figure out what’s wrong with my code, or tell me what a valid path could be? I prefer if the image is stored in a cache location because it’s not important for the image to continue existing after the user leaves the application, but I don’t really care who has access to the image.

I’m doing all testing on the 4.1 emulator, compiling with the 4.1 SDK, and my minimum version is API 8 (2.2).

I have put a case for the intent in onActivityResult(), but I don’t think you guys need to see that code because it shouldn’t be affecting the problem.

  • 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-06-12T20:46:10+00:00Added an answer on June 12, 2026 at 8:46 pm

    I was able to figure out the issue. It seems that instead of using Uri.parse(imagePath), you have to use Uri.fromFile(new File(imagePath)) when you add the extra. I’ve put the new Intent code below in case it helps anyone with the same problem.

    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(imagePath)));
    startActivityForResult(intent, 11);
    

    I am now successfully using context.getExternalCacheDir() to create the full path imagePath. The resulting path that I created is /mnt/sdcard/Android/data/<appPkg>/cache/<appName>/cameraImages/image1.jpg.

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

Sidebar

Related Questions

Have an app that has listings - think classified ads - and each listing
I just need to play a simple sound, I have app that send messages,
I have an app that has two viewcontrollers Viewcontroller and OptionsViewController. Viewcontroller is the
I have an app that has three views. All three views have an Ad
I have an app that I have been working with for over a year,
I have this app that, on first launch, calls 2 different API endpoints on
I have an app that executes commands on a Linux server via SSH just
I have an express app that has a bunch of static javascript files that
I have app that has few schedule tasks that get initiated at application start.
I have an app that has a htdocs folder with static files and a

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.