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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:53:54+00:00 2026-06-09T21:53:54+00:00

I am able to get the image using the code below. After snapping the

  • 0

I am able to get the image using the code below. After snapping the shot I want to turn the image into a byte[]. The thing I am stuck on is how am I supposed to grab the image after taking the picture?

Intent is the intent I use to open the camera but I am not sure if there is something I can override or if the Intent still has my image/bitmap so I can break it down.

[Activity(Label = "CameraPage")]
public class PhotoTaker : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

       SetContentView(Resource.Layout.CameraView);
        ImageButton button = FindViewById<ImageButton>(Resource.Id.imagebutton);
        button.Click += BtnCameraClick;
    }
    private string _imageUri;
    private Intent intent;


    private Boolean isMounted
    {
        get
        {
            return Android.OS.Environment.ExternalStorageState.Equals(Android.OS.Environment.MediaMounted);
        }
    }

    public void BtnCameraClick(object sender, EventArgs eventArgs)
    {
        var uri = ContentResolver.Insert(isMounted
                                             ? MediaStore.Images.Media.ExternalContentUri
                                             : MediaStore.Images.Media.InternalContentUri, new ContentValues());
        _imageUri = uri.ToString();
        intent = new Intent(MediaStore.ActionImageCapture);
        //bitmap = MediaStore.Images.Media.GetBitmap(ContentResolver, uri);
        intent.PutExtra(MediaStore.ExtraOutput, uri);
        StartActivityForResult(intent, 1001);
    }

    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        if (resultCode == Result.Ok && requestCode == 1001)
        {
            Toast.MakeText(this, string.Format("Image URI is {0}", _imageUri), ToastLength.Short).Show();
            Android.Content.Intent temp = new Intent(this, typeof(PayeeInformationViewModel));
            StartActivity(temp);
            //this.byteArr = this.bitmap.GetNinePatchChunk();
          //  byteArr = intent.GetByteArrayExtra(_imageUri);
          //  GetFileStreamPath(this._imageUri);
            //var firstArr = string.Empty;
            //if (byteArr.Length > 5)
            //{
            //    foreach (byte b in byteArr)
            //    {
            //        firstArr += b.ToString();
            //        if (firstArr.Length > 5)
            //        {
            //            break;
            //        }
            //    }
            //}
            //else
            //{
            //    firstArr = "Small";
            //}
          //  Toast.MakeText(this, firstArr, ToastLength.Short).Show();
          //  MemoryStream stream = new MemoryStream(byteArr);
        }
    }
}
  • 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-09T21:53:55+00:00Added an answer on June 9, 2026 at 9:53 pm

    Here is how to convert the image to a byte[]

    
    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        if (resultCode == Result.Ok && requestCode == 1001)
        {
            Android.Net.Uri _currentImageUri = Android.Net.Uri.Parse(_imageUri);
            Bitmap bitmap = BitmapFactory.DecodeStream(ContentResolver.OpenInputStream(_currentImageUri));
    
            byte[] bitmapData = null;
    
            using (MemoryStream stream = new MemoryStream())
            {
                bitmap.Compress(Bitmap.CompressFormat.Png, 0, stream);
                bitmapData = stream.ToArray();
            }
    
            bitmap.Dispose();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the code below I can't get the image in the web page. I'm
I am using the code below to get the attached images for each post
I've embedded some C# code into an iphone objective-c app using monotouch. I'm able
I am able to get the output of a pdf using fpdf, the problem
I have a code setup something like below, the image is part of a
To flip an image around the center i am using this piece of code:
In My Application i am Using the Below Code to Uploade the Photo. While
I'm gathering consecutive images from Kinect's RGB camera from the code below; PlanarImage Image
I'm trying to process an image using ABBYY OCR SDK using the sample code
I have 400 images in my server database. I am able to get those

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.