将图像粘贴到android中的另一个图像上

时间:2012-03-19 11:43:19

标签: android

我希望在设备相机捕获的现有图像上显示ImageView中的图像,然后根据用户需要修改第一个图像,如缩放,旋转,然后点击按钮,想要将该视图保持原样...意味着图像应粘贴在按钮单击的相机捕获图像上...现在我想要的是知道如何在按钮点击上粘贴该图像?

public class Camera_finalActivity extends Activity implements OnTouchListener {

  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.main);
  view = (ImageView) findViewById(R.id.imageView);
  view.setOnTouchListener(this);

  Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  startActivityForResult(cameraIntent,100);

  }   

  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data)  {
        super.onActivityResult(requestCode, resultCode, data); Bundle extras = data.getExtras();
         Bitmap b = (Bitmap) extras.get("data");
         int width = b.getWidth();
         final int height = b.getHeight();
         img1 = (ImageView)findViewById(R.id.imageView1);
         img1.setImageBitmap(b);

     btn = (Button)findViewById(R.id.button1);
     btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

//want some code here to paste the image on camera captured image....

        }
    });

}
//here was the code to zoom and rotate the image......

  }

1 个答案:

答案 0 :(得分:0)

得到它......

只需将以下代码放入网址按钮

即可
                 @Override
        public void onClick(View arg0) {

            view.setOnTouchListener(null); 
                       }

然后截取屏幕截图以保存图片......