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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:43:10+00:00 2026-06-12T08:43:10+00:00

I have reads many question about this, but I still failed using this code…

  • 0

I have reads many question about this, but I still failed using this code… maybe anyone can corect my code… I want to crop an image from file that i know the location using com.android.camera.action.CROP like this…

    mImageCaptureUri = Uri.fromFile(f);
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setType("image/*");

    intent.setData(mImageCaptureUri); 
    intent.putExtra("crop", true);
    intent.putExtra("outputX", 200);
    intent.putExtra("outputY", 200);
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    intent.putExtra("scale", true);
    intent.putExtra("return-data", true);

    Bundle extras = intent.getExtras();

    if (extras != null) {               
        Bitmap photo = extras.getParcelable("intent");

        tampilan.setImageBitmap(photo);
    }

    File f = new File(mImageCaptureUri.getPath());            

    if (f.exists()) f.delete();

But when i run the code, nothing hapend… T.T
can anyone help me??

  • 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-12T08:43:11+00:00Added an answer on June 12, 2026 at 8:43 am

    I had modify my code and its works successfull, this is my code..

    Intent intent = new Intent("com.android.camera.action.CROP");
        intent.setType("image/*");
        List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 );
        int size = list.size();
        if (size == 0) {            
            Toast.makeText(this, "Can not find image crop app", Toast.LENGTH_SHORT).show();
    
            return;
        } else {
            intent.setData(selectImageUri);        
            intent.putExtra("outputX", 300);
            intent.putExtra("outputY", 300);
            intent.putExtra("aspectX", 1);
            intent.putExtra("aspectY", 1);
            intent.putExtra("scale", true);
            intent.putExtra("return-data", true);
            if (size == 1) {
                Intent i        = new Intent(intent);
                ResolveInfo res = list.get(0);
    
                i.setComponent( new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
    
                startActivityForResult(i, CROP_RESULT);
            } else {
    
            }
    
        }
    

    and the activityResult like this

    if (resultCode == RESULT_OK){
            switch (requestCode){
            case SELECT_PICTURE :
                selectImageUri = data.getData();
                doCrop();
            break;
            case CROP_RESULT :
                Bundle extras = data.getExtras();
    
                if (extras != null) {               
                    bmp = extras.getParcelable("data");
                    temporary.setBitmap(bmp);
    
                }
                File f = new File(selectImageUri.getPath());            
    
                if (f.exists()) f.delete();
                Intent inten3 = new Intent(this, tabActivity.class);
                startActivity(inten3);
            break;
            case CAMERA_IMAGE :
                doCrop();
            break;
            }
        }
    

    maybe its useful 😀

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

Sidebar

Related Questions

I have read many question about improving the performance of C++ and C code
I have read many questions about Android, J2ME and RecordStore , but I still
I have read many documents still very confused about HTTP Live Streaming . But
i have one question. I ready many pages about best thereading like this http://www.albahari.com/threading/part4.aspx
I have read many questions about the facebook login but until not I didnt
My question is in relation this this answer. https://stackoverflow.com/a/8773953/1297775 I have read at many
I have read many answers regarding this still i am getting confused if i
I have read many article about this one. I want to hear from you.
I read a lot about handling rotation in android applications, but I still have
I know that this question has been asked many times ( but in different

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.