2015-02-09 51 views
-3

如果我不想照片并拍摄另一张照片并通过彩信发送照片,我想用图像视图中的删除按钮拍照并将其显示在图像视图中。android捕获照片并将其保存在图像视图中并发送彩信?

+0

你可以检查这个问题的答案[问题](http://stackoverflow.com/q/5991319/2688283)。你也应该参考[android的文档](http://developer.android.com/training/camera/photobasics.html)。 – iRuth 2015-02-10 03:45:01

回答

0

声明巴顿和ImageView的

ImageView imageView= (ImageView)this.findViewById(R.id.imageView1); 
Button photoButton = (Button) this.findViewById(R.id.button1); 

按钮的onclick捕获图像

photoButton.setOnClickListener(new View.OnClickListener() { 
     public void onClick(View v) { 
       Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
       startActivityForResult(cameraIntent, CAMERA_REQUEST); 
      } 
     }); 

放置拍摄图像分割成的ImageView

protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
     if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) { 
      Bitmap photo = (Bitmap) data.getExtras().get("data"); 
      imageView.setImageBitmap(photo); 
     } 
    } 

需要在清单文件

添加
<uses-feature android:name="android.hardware.camera"></uses-feature> 

我倒没意识到发送该图像MMS

了解更多参考

How to send image via MMS in Android?

+0

谢谢aloooot .. – 2015-02-20 09:40:21

+0

我想要CAMERA_REQUEST = 1888的含义; – 2015-02-20 09:40:45

相关问题