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

  • Home
  • SEARCH
  • 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 6022173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:49:15+00:00 2026-05-23T03:49:15+00:00

I have a question this time around regarding the Android custom camera, NOT the

  • 0

I have a question this time around regarding the Android custom camera, NOT the built in camera that is accessible through Camera_intent. I am not permitted to use that one. What I am attempting to do is allow a user to aim the camera at something and choose “Send” on the onOptionsItemMenu.

I am not having any issues getting this implemented…separately. If I ask it to send something with the click of a button, it sends. If I tell the camera to save the picture without sending it, it does.

I run into a problem when I try to do both. As it stands, using this code:

 public boolean onOptionsItemSelected(MenuItem item) {
        Intent i;
        File file2;
        camera.takePicture(null, mPictureCallback, mPictureCallback);
        switch (item.getItemId()) {

        case R.id.save:
            return super.onOptionsItemSelected(item);

        case R.id.send:

            file2 = new File(filename);
            i = new Intent(Intent.ACTION_SEND);
            i.putExtra(Intent.EXTRA_SUBJECT, "Sample Picture");
            System.out.println("file//" + file2);
            i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file//" + file2));
            i.setType("image/png");
            startActivity(Intent.createChooser(i, "Email file"));
            finish();
            return super.onOptionsItemSelected(item);

The camera “clicks” or “flickers” as if it is taking the picture and then it immediately opens the mail client choose. When I select which I want to take Gmail is saying that the location is null. However if I remove the part that starts the email chooser, the image saves properly and is there.

Almost as if it is skipping over that camera taking step.

Im sure the solution to this is simple, I just have a baked brain right now and probably can’t see the forest because of the trees. (if that is even how that analogy is said).

Do I run the camera part on another thread?

An idea I had was to use a boolean to check for the file’s existence and size, but I am unsure how to make the program check that over and over again until it returns true.

  • 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-23T03:49:15+00:00Added an answer on May 23, 2026 at 3:49 am

    I’m guessing what might be happening is that your callback is occurring on a separate thread. So, your “open mail client” action is occurring while your image is still being saved. What you should try, is have a flag of some sort that tells you if you are doing a send or save. Set this in the onOptionsItemSelected before you open the camera.. Then, in your mPictureCallback have that perform your ACTION_SEND intent (or save action)

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

Sidebar

Related Questions

I have been asking myself this question for a long time now. Thought of
This is a question I have wondered about for quite some time, yet I
This seems like a pretty softball question, but I always have a hard time
I have this question: Does implementing a custom MembershipProvider class needs you to implement
I have a question about this question . I posted a reply there but
I have a question concerning this code which I want to run on QNX:
The responses I've got to this question have solved the problem I had in
I am new to C and i have this question. why does the following
I have seen this question: Are there any decent UI components for touch screen
I have a similar question to this one SQL products/productsales I want to do

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.