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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:38:37+00:00 2026-06-05T04:38:37+00:00

I having a problem when rotate the bitmap. My requirement is as follows, Capture

  • 0

I having a problem when rotate the bitmap. My requirement is as follows,

  1. Capture Image through Camera and display the capture image in an ImageView.
  2. When i click/touch the image, show two buttons over the imageview. One button for Rotate the image respect to clockwise (45 degree) direction and the another one button to rotate the image respect to anti-clockwise direction.

    I used the below code for this process, unfortunately it works only once time, when i click the button at first time ti will rotate the image corresponding to 45 degree after that there is no change in button click.
    // onclick

    public void onClick(View v) {

        switch (v.getId()) {
    
        case R.id.right_image_rotate:
    
            try {
                System.gc();
                Runtime.getRuntime().gc();
                unbindDrawables(findViewById(R.id.image_viewer));
                imageRotate();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            break;
    
        case R.id.left_image_rotate:
    
            try {
                System.gc();
                Runtime.getRuntime().gc();
                unbindDrawables(findViewById(R.id.image_viewer));
                imageRotate();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            break;
        case R.id.image_viewer:
            rotateLayout.setVisibility(View.VISIBLE);
            imageLeft_rotate.setVisibility(View.VISIBLE);
            imageRight_rotate.setVisibility(View.VISIBLE);
            break;
        default:
            break;
        }
    }
    
    
    
        Bitmap bitmapOrg = BitmapFactory.decodeFile(saved_image_file
                .getAbsolutePath());
    
        int width = bitmapOrg.getWidth();
    
        int height = bitmapOrg.getHeight();
    
        int newWidth = 200;
    
        int newHeight = 200;
    
        // calculate the scale - in this case = 0.4f
    
        float scaleWidth = ((float) newWidth) / width;
    
        float scaleHeight = ((float) newHeight) / height;
    
        Matrix matrix = new Matrix();
    
        matrix.postScale(scaleWidth, scaleHeight);
        matrix.postRotate(45);
    
        Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0, width,
                height, matrix, true);
    
        srcBitmap.setScaleType(ScaleType.CENTER);
        srcBitmap.setImageBitmap(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-05T04:38:40+00:00Added an answer on June 5, 2026 at 4:38 am

    It’s because each time you click the button, you’re still referencing the ORIGINAL image, not the one you changed. If you want to continue rotating or modifying the changed image, you’ll have to reference it; not the original.

    Just make a global variable and store the changed bitmap in there. Then when the button is pressed, check if it’s null or not. If it is null, use the original; else use the changed one

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

Sidebar

Related Questions

i having problem with draw image in applet. i want to display all images
I'm having a problem getting a bitmap to rotate properly. I have a SurfaceView
I am having a problem when trying to rotate my particle system. First off,
i want to rotate the image of imageView, i have scaled the image using
Having problem with my application, I seem to be new in ios. My project
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
I am having problem with Jquery tabs UI. <script type=text/javascript> $(document).ready(function() { $('.tabs').tabs(); $('.subtabs').tabs();
I am having problem rightnow because when I am logging in on mysql using
I'm having problem with getting location.hostname for newly created window in javascript. For example
I'm having problem with triggering function on delete_post action. I'm building functionality where i

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.