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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:09:08+00:00 2026-06-02T03:09:08+00:00

I’m currently developing a camera application for Android on which some problems have occurred.

  • 0

I’m currently developing a camera application for Android on which some problems have occurred. I need it to work on all Android devices and since all of these works in different ways specially with the camera hardware, I’m having a hard time finding a solution that works for every device.

My application main goal is to launch the camera on a button click, take a photo and upload it to a server. So I don’t really need the functionality of saving the image on the device, but if that’s needed for further image use I might as well allow it.

For example I’m testing my application on a Samsung Galaxy SII and a Motorola Pad. I got working code that launches the camera, which is by the way C# code since I’m using Monodroid:

Intent cameraIntent = new Intent(Android.Provider.MediaStore.ActionImageCapture);  
StartActivityForResult(cameraIntent, PHOTO_CAPTURE);

And I fetch the result, similar to this guide I followed:
http://kevinpotgieter.wordpress.com/2011/03/30/null-intent-passed-back-on-samsung-galaxy-tab/
Why I followed this guide is because the activity returns null on my galaxy device (Another device oriented problem).

This code works fine on the Galaxy device. It takes a photo and saves the photo in the gallery from which i can upload to a server. By further research this is apparently galaxy standard behaviour, so this doesn’t work on my Motorola pad. The camera works fine, but no image is saved to gallery.

So with this background my question is, am I on the right path here? Do I need to save the image to gallery in order for further use in my application? Is there any solution that works for every Android device, cause that’s the solution i need.

Thanks for any feedback!

  • 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-02T03:09:10+00:00Added an answer on June 2, 2026 at 3:09 am

    To long2know:
    Yes the same concepts applies to Monodroid. I’ve already read the stack article you linked among with some other similar. However i don’t like the approach in that particular post since it checks for bugs for some devices that are hardcoded into a collection. Meaning it might fail to detect bugs in future devices. Since i won’t be doing maintenance on this application, i can’t allow this. I found a solution elsewhere and adapted it to my case and i’ll post it below if someone would need it. It works on both my devices, guessing it would work for the majority of other devices. Thanks for your post!

    Solution that allows you to snap a picture and use, also with the option of using a image from gallery. Solution uses option menu for these purposes, just for testing. (Monodroid code).

    Camera code is inspired by:
    access to full resolution pictures from camera with MonoDroid

    namespace StackOverFlow.UsingCameraWithMonodroid
    {
        [Activity(Label = "ImageActivity")]
        public class ImageActivity
            private readonly static int TakePicture = 1;
            private readonly static int SelectPicture = 2;
            private string imageUriString;
    
            protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
                this.SetContentView(Resource.Layout.ImageActivity);
            }
    
            public override bool OnCreateOptionsMenu(IMenu menu)
            {
                MenuInflater flate = this.MenuInflater;
                flate.Inflate(Resource.Menu.ImageMenues, menu);
    
                return base.OnCreateOptionsMenu(menu);
            }
    
            public override bool OnOptionsItemSelected(IMenuItem item)
            {
                switch (item.ItemId)
                {
                    case Resource.Id.UseExisting:
                        this.SelectImageFromStorage();
                        return true;
                    case Resource.Id.AddNew:
                        this.StartCamera();
                        return true;
                    default:
                        return base.OnOptionsItemSelected(item);
                }
            }
    
            private Boolean isMounted
            {
                get
                {
                    return Android.OS.Environment.ExternalStorageState.Equals(Android.OS.Environment.MediaMounted);
                }
            }
    
            private void StartCamera()
            {
                var imageUri = ContentResolver.Insert(isMounted ? MediaStore.Images.Media.ExternalContentUri
                                        : MediaStore.Images.Media.InternalContentUri, new ContentValues());
    
                this.imageUriString = imageUri.ToString();
    
                var cameraIntent = new Intent(MediaStore.ActionImageCapture);
                cameraIntent.PutExtra(MediaStore.ExtraOutput, imageUri);
                this.StartActivityForResult(cameraIntent, TakePicture);
            }
    
            private void SelectImageFromStorage()
            {
                Intent intent = new Intent();
                intent.SetType("image/*");
                intent.SetAction(Intent.ActionGetContent);
                this.StartActivityForResult(Intent.CreateChooser(intent,
                        "Select Picture"), SelectPicture);
    
            }
    
            // Example code of using the result, in my case i want to upload in another activity
            protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
            {
                // If a picture was taken
                if (resultCode == Result.Ok && requestCode == TakePicture)
                {
                    // For some devices data can become null when using the camera activity.
                    // For this reason we save pass the already saved imageUriString to the upload activity
                    // in order to adapt to every device. Instead we would want to use the data intent
                    // like in the SelectPicture option.
    
                    var uploadIntent = new Intent(this.BaseContext, typeof(UploadActivity));
                    uploadIntent.PutExtra("ImageUri", this.imageUriString);
                    this.StartActivity(uploadIntent);
                }
                // User has selected a image from storage
                else if (requestCode == SelectPicture)
                {
                    var uploadIntent = new Intent(this.BaseContext, typeof(UploadActivity));
                    uploadIntent.PutExtra("ImageUri", data.DataString);
                    this.StartActivity(uploadIntent);
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have just tried to save a simple *.rtf file with some websites and
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't

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.