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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:42:09+00:00 2026-05-24T04:42:09+00:00

I have already selected an image from SD card in my activity’s ImageView using

  • 0

I have already selected an image from SD card in my activity’s ImageView using Intent.and now I want to show a fixed size moving Rectangle i.e. we have to use gesture and whatever portion of the image we want,then we are able to crop that.How can we do that?Its really tough for me to do?
Please help me in doing that?

Update–>I have been able to bring the rectangle and I m getting problem in cropping and saving that selected part.How to do this?

  • 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-24T04:42:10+00:00Added an answer on May 24, 2026 at 4:42 am

    ok geetanjali. try this code this will open gallery and you can pick a photo to crop, it will store with name starts from apple, you can see cropped image in your activity

    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
            photoPickerIntent.setType("image/*");
            photoPickerIntent.putExtra("crop","true");
            photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempFile());
            photoPickerIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
             startActivityForResult(photoPickerIntent, 1);
    
        }
    
           private Uri getTempFile() {
           if (isSDCARDMounted()) {
               String f;
               muri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
                        "apple_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
           //File f = new File(Environment.getExternalStorageDirectory(),"titus1.jpg");
           try {
            f=muri.getPath();
           } catch (Exception e) {
    
           }
           return muri;
           } else {
           return null;
           }
          }
       private boolean isSDCARDMounted(){
           String status = Environment.getExternalStorageState();
           if (status.equals(Environment.MEDIA_MOUNTED))
           return true;
           return false;
           }
       protected void onActivityResult(int requestCode, int resultCode,
               Intent imageReturnedIntent) {
           super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
    
           switch (requestCode) {
           case 1:
               if (resultCode == RESULT_OK) {  
               String filePath= muri.getPath();
               Log.e("path", "filePath");
               Toast.makeText(this, filePath, Toast.LENGTH_LONG).show();
    
               Bitmap selectedImage =  BitmapFactory.decodeFile(filePath);
               image = (ImageView)findViewById(R.id.image);
               image.setImageBitmap(selectedImage);
    
    
            }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.