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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:45:27+00:00 2026-06-06T17:45:27+00:00

Hi I am developing a app that captures images and email it capturing the

  • 0

Hi I am developing a app that captures images and email it capturing the images is working fine on Samsung galaxy and Sony Ericsson xperia but it’s not working on HTC devices anyone know a reason why ?? here is my code for capturing images

try {
    String fileName = Image_name+".jpg";
    //create parameters for Intent with filename
    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.TITLE, fileName);
    values.put(MediaStore.Images.Media.DESCRIPTION,"Image capture by camera");
    //imageUri is the current activity attribute, define and save it for later usage (also in onSaveInstanceState)
    outuri = getContentResolver().insert(
    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    //outuri = Uri.fromFile(photo);
    cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outuri);
    cameraIntent.putExtra("return-data", true);
    startActivityForResult(cameraIntent, 2);
} catch (Exception e) {
    Toast.makeText(preview.this, ""+e, Toast.LENGTH_LONG).show();
}

and here is code that I use to retrieve images

path = convertImageUriToFile(outuri, preview.this).getAbsolutePath();
arr.add(path);
try {
    bitmap = getImage(path);
    public static File convertImageUriToFile (Uri imageUri, Activity activity)  {
        Cursor cursor = null;
        try {
            String [] proj={MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID, MediaStore.Images.ImageColumns.ORIENTATION};
            cursor = activity.managedQuery(imageUri, proj, // Which columns to return
                    null,       // WHERE clause; which rows to return (all rows)
                    null,       // WHERE clause selection arguments (none)
                    null); // Order-by clause (ascending by name)
            int file_ColumnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            int orientation_ColumnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION);
            if (cursor.moveToFirst()) {
                String orientation =  cursor.getString(orientation_ColumnIndex);
                return new File(cursor.getString(file_ColumnIndex));
            }
            return null;
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }
    }

    public Bitmap getImage(String path) throws IOException
    {
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeFile(path, options);
        Bitmap targetBitmap=null;
        int srcWidth = options.outWidth;
        int srcHeight = options.outHeight;
        int[] newWH =  new int[2];
        newWH[0] = 1024;
        newWH[1] = (1024*srcHeight)/srcWidth;

        int inSampleSize = 1;
        while(srcWidth / 2 > newWH[0]){
            srcWidth /= 2;
            srcHeight /= 2;
            inSampleSize *= 2;
        }
//      float desiredScale = (float) newWH[0] / srcWidth;
        // Decode with inSampleSize
        options.inJustDecodeBounds = false;
        options.inDither = false;
        options.inSampleSize = inSampleSize;
        options.inScaled = false;
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        Bitmap sampledSrcBitmap = BitmapFactory.decodeFile(path,options);
        ExifInterface exif = new ExifInterface(path);
        String s=exif.getAttribute(ExifInterface.TAG_ORIENTATION);
        System.out.println("Orientation>>>>>>>>>>>>>>>>>>>>"+s);
        Matrix matrix = new Matrix();
        float rotation = rotationForImage(preview.this, Uri.fromFile(new File(path)));
        if (rotation != 0f) {
            matrix.preRotate(rotation);
        }
        int newh = ( w * sampledSrcBitmap.getHeight() ) /sampledSrcBitmap.getWidth();
        Bitmap r=Bitmap.createScaledBitmap(sampledSrcBitmap, w, newh, true);
        Bitmap resizedBitmap = Bitmap.createBitmap(
                r, 0, 0, w, newh, matrix, true);

        return resizedBitmap;
    }
}
  • 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-06T17:45:28+00:00Added an answer on June 6, 2026 at 5:45 pm

    well, there’s a known bug in the Intent.putExtra(MediaStore.EXTRA_OUTPUT) and it causes a crash in the app.

    check out the answer I got when asking the same question: https://stackoverflow.com/a/10613299/1056359

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

Sidebar

Related Questions

(I am developing an app that presents chat messages in a table. But, this
im developing an app that retrieves a rss feed from a website but i
I'm developing an app that use a lot of images, I'm using the UIWebView
Im developing an app that shows big images.. There are a lot of images
Developing an app that uses data synchronization. Sending images (even resized) takes time if
I'm developing an app that receive contente (URI) and I'm testing it with IE10
I am developing an app that needs the chat functionality, presenting messages sent and
I am developing an app that has java files and php files. The java
i'm developing an app that has a jtable and user could start a download.
I'm developing an app that starts a System.Threading.Timer which does some fairly rapid reading/writing

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.