2014-02-26 63 views
0

在我的應用程序中,我點擊一個按鈕來旋轉圖像。現在,當我將圖像傳遞給另一個活動時,我不想放鬆圖像的旋轉角度。如何將ImageView中的旋轉圖像傳遞給另一個活動?

這是我如何旋轉圖像。

在按鈕的的onclick「旋轉」

btn_rotate.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      rotateImage(true); 
     } 

    }); 

public void rotateImage(boolean rotate) { 
    RotateAnimation animation = null; 
    if (rotate) { 
     animation = new RotateAnimation(rotation, rotation + 90, 
     picview.getWidth()/2, picview.getHeight()/2); 
     rotation += 90; 
     rotation %= 360; 
    } else { 
     animation = new RotateAnimation(0, rotation, 
     picview.getWidth()/2, picview.getHeight()/2); 

    } 
    animation.setDuration(0); 
    animation.setFillAfter(true); 
    animation.setInterpolator(new LinearInterpolator());   
    picview.startAnimation(animation); 

} 

我通過旋轉角度:

send_image.putExtra("rotation_angle", rotation); 

但在接收活動如何申請的rotation_angle上的形象呢?有人能指導我嗎?

謝謝。

+0

animarions用於動畫的東西,你與他們做的是用眼過度 – pskink

回答

0

作爲最佳實踐,不要從意圖傳遞位圖,因爲它是沉重的對象。 像

1. In your application class with get and set bitmap 
2. Save rotated bitmap into Sdcard in one activity and retrieve that in other activity 

相反,你可以有幾種選擇希望它可以幫助

相關問題